Jump to content

[SOLVED] insert and select help!


countdrac

Recommended Posts

im trying to do an INSERT then right away a SELECT (on that insert )

 

and for some reason the SELECT it returns nothing...

 

im kinda new to mysql...

 

$query = "INSERT INTO category (category_name) VALUES('".$category."')";
	$result = mysql_query($query) or die(mysql_error());

$query = "SELECT category_id FROM category WHERE category_name = '".$category."'";
	$result = @mysql_query($query) or die(mysql_error());
	while ($row = mysql_fetch_array($result)) 
	{
		$category_id = $row['$category_id'];
	}

 

thanks

Link to comment
https://forums.phpfreaks.com/topic/80259-solved-insert-and-select-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.