my code stock.com

oliver russell

select Query Execution in CRUD
by oliver russell

Here is how to select Query Execution when creating CRUD in PHP and MySQL (https://www.cloudways.com/blog/execute-crud-in-mysql-php/ )
Now, let us select the data from our MySQL database using single query execution. Write a new function in your crud.php written below:

Snippet options

Download: Download snippet as select-query-execution-in-crud.php.
Copy snippet: For this you need a free my code stock.com account.
Embed code : You will find the embed code for this snippet at the end of the page, if you want to embed it into a website or a blog!

function selectdata($sql)
{
	$conn = OpenCon();
	
	$result = $conn->query($sql);
	if($result)
	{
		if($result->num_rows > 0)
		{
			return $result;
		}
		else
		{
			return "zero";
		}
	}
	else
	{
		return $result->error;
	}
}

Create a free my code stock.com account now.

my code stok.com is a free service, which allows you to save and manage code snippes of any kind and programming language. We provide many advantages for your daily work with code-snippets, also for your teamwork. Give it a try!

Find out more and register now

You can customize the height of iFrame-Codes as needed! You can find more infos in our API Reference for iframe Embeds.