Page 1 of 1

streamlining mysql_query()?

Posted: Fri Jul 15, 2005 10:18 pm
by imstupid
I've been working with php for about 8 months or so, and I've almost figured out enough where I don't have to post problems every single day. I was wondering if someone could check out this code and see if there is a faster way to write it out. It's a basic query I use all the time, but just seems like a lot of lines if all I want is to get data from mysql columns individually.

Code: Select all

<?PHP
$pizzatastesgood = mysql_query("SELECT food FROM table WHERE food='$conqueso'") ; 
	$toomanypepperonis = mysql_fetch_array( $pizzatastesgood )
		or die(mysql_error()); 
?>
then sometimes i'm also doing things like

Code: Select all

<?PHP
$pizza = $toomanypepperonis['pizza'] ;
?>
depending on what die(mysql_error()); gives me. I guess I'm just missing the big picture (such as when to use mysql_select, vs. mysql__fetch_array) and was wondering if there was a better resource to get some basic php knowledge other than the php manual. After searches, I either get the manual in German, or feel like its sentences are missing things like "verbs" or something. It's rough for us people just starting out.

thanks as alwaysso, and I've almost figured out enough where I don't have to post problems every single day. I was wondering if someone could check out this code and see if there is a faster way to write it out. It's a basic query I use all the time, but just seems like a lot of lines if all I want is to get data from mysql columns individually.

Code: Select all

<?PHP
$pizzatastesgood = mysql_query("SELECT food FROM table WHERE food='$conqueso'") ; 
	$toomanypepperonis = mysql_fetch_array( $pizzatastesgood )
		or die(mysql_error()); 
?>
then sometimes i'm also doing things like

Code: Select all

<?PHP
$pizza = $toomanypepperonis['pizza'] ;
?>
depending on what die(mysql_error()); gives me. I guess I'm just missing the big picture (such as when to use mysql_select, vs. mysql__fetch_array) and was wondering if there was a better resource to get some basic php knowledge other than the phphere I don't have to post problems every single day. I was wondering if someone could check out this code and see if there is a faster way to write it out. It's a basic query I use all the time, but just seems like a lot of lines if all I want is to get data from mysql columns individually.

Code: Select all

<?PHP
$pizzatastesgood = mysql_query("SELECT food FROM table WHERE food='$conqueso'") ; 
	$toomanypepperonis = mysql_fetch_array( $pizzatastesgood )
		or die(mysql_error()); 
?>
then sometimes i'm also doing things like

Code: Select all

<?PHP
$pizza = $toomanypepperonis['pizza'] ;
?>
depending on what die(mysql_error()); gives me. I guess I'm just missing the big picture (such as when to use mysql_select, vs. mysql__fetch_arrayI was wondering if someone could check out this code and see if there is a faster way to write it out. It's a basic query I use all the time, but just seems like a lot of lines if all I want is to get data from mysql columns individually.

Code: Select all

<?PHP
$pizzatastesgood = mysql_query("SELECT food FROM table WHERE food='$conqueso'") ; 
	$toomanypepperonis = mysql_fetch_array( $pizzatastesgood )
		or die(mysql_error()); 
?>
then sometimes i'm also doing things like

Code: Select all

<?PHP
$pizza = $toomanypepperonis['pizza'] ;
?>
depending on what die(mysql_error()); gives me. I guess I'm just missing the big picture (such as when to use mysql_select, vs. mysql__fetch_array) and was wondering if there was a better s every single day. I was wondering if someone could check out this code and see if there is a faster way to write it out. It's a basic query I use all the time, but just seems like a lot of lines if all I want is to get data from mysql columns individually.

Code: Select all

<?PHP
$pizzatastesgood = mysql_query("SELECT food FROM table WHERE food='$conqueso'") ; 
	$toomanypepperonis = mysql_fetch_array( $pizzatastesgood )
		or die(mysql_error()); 
?>
then sometimes i'm also doing thingswith php for about 8 months or so, and I've almost figured out enough where I don't have to post problems every single day. I was wondering if someone could check out this code and see if there is a faster way to write it out. It's a basic query I use all the time, but just seems like a lot of lines if all I want is to get data from mysql columns individually.

Code: Select all

<?PHP
$pizzatastesgood = mysql_query("SELECT food FROM table WHERE food='$conqueso'") ; 
	$toomanypepperonis = mysql_fetch_array( $pizzatastesgood )
		or die(mysql_error()); 
?>
then sometimes i'm also doing things like

Code: Select all

<?PHP
$pizza = $toomanypepperonis['pizza'] ;
?>
depending on what die(mysql_error()); gives me. I guess I'm just missing the big picture (such as when to use mysql_select, vs. mysql__fetch_array) and was wondering if there was a better resource to get some basic php knowledge other than the php manual. After searches, I either get the manual in German, or feel like its sentences are missing things like "verbs" or something. It'with php for about 8 months or so, and I've almost figured out enough where I don't have to post problems every single day. I was wondering if someone could check out this code and see if there is a faster way to write it out. It's a basic query I use all the time, but just seems like a lot of lines if all I want is to get data from mysql columns individually.

Code: Select all

<?PHP
$pizzatastesgood = mysql_query("SELECT food FROM table WHERE food='$conqueso'") ; 
	$toomanypepperonis = mysql_fetch_array( $pizzatastesgood )
		or die(mysql_error()); 
?>
then sometimes i'm also doing things like

Code: Select all

<?PHP
$pizza = $toomanypepperonis['pizza'] ;
?>
depending on what die(mysql_error()); gives me. I guess I'm just missing the big picture (such as when to use mysql_select, vs. mysql__fetch_array) and was wondering if there was a better resource to get some basic php knowledge other than the php manual. After searches, I either get the manual in German, or feel like its sentences are missing things like "verbs" or something. It's rough for us people just starting out.

thanks as alwaysgt;

then sometimes i'm also doing things like

Code: Select all

<?PHP
$pizza = $toomanypepperonis['pizza'] ;
?>
depending on what die(mysql_error()); gives me. I guess I'm just missing the big picture (such as when to use mysql_select, vs. mysql__fetch_array) and was wondering if there was a better resource to get some basic php knowledge other than the php manual. After searches, I either get the manual in German, or feel like its sentences are missing things like "verbs" or something. It's rough for us people just starting out.

thanks as alwaysme. I guess I'm just missing the big picture (such as when to use mysql_select, vs. mysql__fetch_array) and was wondering if there was a better resource to get some basic php knowledge other than the php manual. After searches, I either get the manual in German, or feel like its sentences are missing things like "verbs" or something. It's rough for us people just starting out.

thanks as alwayswhere I don't have to post problems every single day. I was wondering if someone could check out this code and see if there is a faster way to write it out. It's a basic query I use all the time, but just seems like a lot of lines if all I want is to get data from mysql columns individually.

Code: Select all

<?PHP
$pizzatastesgood = mysql_query("SELECT food FROM table WHERE food='$conqueso'") ; 
	$toomanypepperonis = mysql_fetch_array( $pizzatastesgood )
		or die(mysql_error()); 
?>
then sometimes i'm also doing things like

Code: Select all

<?PHP
$pizza = $toomanypepperonis['pizza'] ;
?>
[/php:1:6ost problems every single day. I was wondering if someone could check out this code and see if there is a faster way to write it out. It's a basic query I use all the time, but just seems like a lot of lines if all I want is to get data from mysql columns individually.

Code: Select all

<?PHP
$pizzatastesgood = mysql_query("SELECT food FROM table WHERE food='$conqueso'&quote;) ; 
	$toomanypepperonis = mysql_fetch_array( $pizzatastesgood )
		or die(mysql_error()); 
?&gt;
then sometimes i'm also doing things like

Code: Select all

<?PHP
$pizza = $toomanypepperonis['pizza'] ;
?>
depending onI've almost figured out enough where I don't have to post problems every single day. I was wondering if someone could check out this code and see if there is a faster way to write it out. It's a basic query I use all the time, but just seems like a lot of lines if all I want is to get data from mysql columns individually.

Code: Select all

<?PHP
$pizzatastesgood = mysql_query("SELECT food FROM table WHERE food='$conqueso'") ; 
	$toomanypepperonis = mysql_fetch_array( $pizzatastesgood )
		or die(mysql_error()); 
?>
then sometimes i'm also doing things like

Code: Select all

<?PHP
$pizza = $toomanypepperonis['pizza'] ;
?>
depending on what die(mysql_error()); gives me. I guess I'm just missing the big picture (such as when to use mysql_select, vs. mysql__fetch_array) and was wondering if there was a better resource to get some basic php knowledge other than the php manual. After searches, I either get the manual in German, or feelre is a faster way to write it out. It's a basic query I use all the time, but just seems like a lot of lines if all I want is to get data from mysql columns individually.

Code: Select all

<?PHP
$pizzatastesgood = mysql_query("SELECT food FROM table WHERE food='$conqueso'") ; 
	$toomanypepperonis = mysql_fetch_array( $pizzatastesgood )
		or die(mysql_error()); 
?>
then sometimes i'm also doing things like

Code: Select all

<?PHP
$pizza = $toomanypepperonis['pizza'] ;
?>
depending on what die(mysql_error()); gives me. I guess I'm just missing the big picture (such as when to use mysql_select, vs. mysql__fetch_array) and was wondering if there was a better resource to get some basic php knowledge other than the php manual. After searches, I either get the manual in German, or feel like its sentences are missing things like "verbdually.

Code: Select all

<?PHP
$pizzatastesgood = mysql_query("SELECT food FROM table WHERE food='$conqueso'") ; 
	$toomanypepperonis = mysql_fetch_array( $pizzatastesgood )
		or die(mysql_error()); 
?>
then sometimes i'm also doing things like

Code: Select all

<?PHP
$pizza = $toomanypepperonis['pizza'] ;
?>
depending on what die(mysql_error()); gives me. I guess I'm just missing the big picture (such as when to use mysql_select, vs.about 8 months or so, and I've almost figured out enough where I don't have to post problems every single day. I was wondering if someone could check out this code and see if there is a faster way to write it out. It's a basic query I use all the time, but just seems like a lot of lines if all I want is to get data from mysql columns individually.

Code: Select all

<?PHP
$pizzatastesgood = mysql_query("SELECT food FROM table WHERE food='$conqueso'") ; 
	$toomanypepperonis = mysql_fetch_array( $pizzatastesgood )
		or die(mysql_error()); 
?>
then sometimes i'm also doing things like

Code: Select all

<?PHP
$pizza = $toomanypepperonis['pizza'] ;
?>
depending on what die(mysql_error()); gives me. I guess I'm just missing the big picture (such as when to use mysql_select, vs. mysql__fetch_array) and was wondering if there was a better resource to get some basic php knowledge other than the php manual. After searches, I either get the manual in German, or feel like its sentences are missing things like "verbs" or something. It's rough for us people just starting out.

thanks as alwaysall the time, but just seems like a lot of lines if all I want is to get data from mysql columns individually.

Code: Select all

<?PHP
$pizzatastesgood = mysql_query("SELECT food FROM table WHERE food='$conqueso'") ; 
	$toomanypepperonis = mysql_fetch_array( $pizzatastesgood )
		or die(mysql_error()); 
?>
then sometimes i'm also doing things like

Code: Select all

<?PHP
$pizza = $toomanypepperonis['pizza'] ;
?>
depending on what die(mysql_error()); gives me. I guess I'm just missing the big picture (such as when to use mysql_select, vs. mysql__fetch_array) and was wondering if there was a better resource to get some basic php knowledge other than the php manual. After searches, I either get the manual in German, or feel like its sentences are missing things like "verbs" or something. It's rough for us people just starting o209c]
<?PHP
$pizzatastesgood = mysql_query("SELECT food FROM table WHERE food='$conqueso'") ;
$toomanypepperonis = mysql_fetch_array( $pizzatastesgood )
or die(mysql_error());
?>

then sometimes i'm also doing things like

Code: Select all

<?PHP
$pizza = $toomanypepperonis['pizza'] ;
?>
depending on what die(mysql_error()); gives me. I guess I'm just missing the big picture (such as when to use mysql_select, vs. mysql__fetch_array) and was wondering if there was a better resource to get some basic php knowledge other than the php manual. After searches, I either get the manual in German, or feel like its sentences are missing things like "verbs" or something. It's rough for us people just starting out.

thanks as always


depending on what die(mysql_error()); gives me. I guess I'm just missing the big picture (such as when to use mysql_select, vs. mysql__fetch_array) and was wondering if there was a better resource to get some basic php knowledge other than the php manual. After searches, I either get the manual in German, or feel like its sentences are missing things like "verbs" or something. It's rough for us people just starting out.

thanks as alwayser way to write it out. It's a basic query I use all the time, but just seems like a lot of lines if all I want is to get data from mysql columns individually.

Code: Select all

<?PHP
$pizzatastesgood = mysql_query("SELECT food FROM table WHERE food='$conqueso'") ; 
	$toomanypepperonis = mysql_fetch_array( $pizzatastesgood )
		or die(mysql_error()); 
?>
then sometimes i'm also doing things like

Code: Select all

<?PHP
$pizza = $toomanypepperonis['pizza'] ;
?>
depending on what die(mysql_error()); gives me. I guess I'm just missing the big picture (such as when to use mysql_select, vs. mysql__fetch_array) and was wondering if there was a better resource to get some basic php knowledge other than the php ms like a lot of lines if all I want is to get data from mysql columns individually.

Code: Select all

<?PHP
$pizzatastesgood = mysql_query("SELECT food FROM table WHERE food='$conqueso'") ; 
	$toomanypepperonis = mysql_fetch_array( $pizzatastesgood )
		or die(mysql_error()); 
?>
then sometimes i'm also doing things like

Code: Select all

<?PHP
$pizza = $toomanypepperonis['pizza'] ;
?>
depending on what die(mysql_error()); gives me. I guess I'm just missing the big picture (such as when to use mysql_select, vs. mysql__ die(mysql_error());
?>

then sometimes i'm also doing things like

Code: Select all

<?PHP
$pizza = $toomanypepperonis['pizza'] ;
?>
depending on what die(mysql_error()); gives me. I guess I'm just missing the big picture (such as when to use mysql_select, vs. mysql__fetch_array) and was wondering if there was a better resource to get some basic php knowledge other than the php manual. After searches, I either get the manual in German, or feel like its sentences are missing things like "verbs" or something. It's rough forwith php for about 8 months or so, and I've almost figured out enough where I don't have to post problems every single day. I was wondering if someone could check out this code and see if there is a faster way to write it out. It's a basic query I use all the time, but just seems like a lot of lines if all I want is to get data from mysql columns individually.

Code: Select all

<?PHP
$pizzatastesgood = mysql_query("SELECT food FROM table WHERE food='$conqueso'") ; 
	$toomanypepperonis = mysql_fetch_array( $pizzatastesgood )
		or die(mysql_error()); 
?>
then sometimes i'm also doing things like

Code: Select all

<?PHP
$pizza = $toomanypepperonis['pizza'] ;
?>
depending on what die(mysql_error()); gives me. I guess ql_query("SELECT food FROM table WHERE food='$conqueso'") ;
$toomanypepperonis = mysql_fetch_array( $pizzatastesgood )
or die(mysql_error());
?>

then sometimes i'm also doing things like

Code: Select all

<?PHP
$pizza = $toomanypepperonis['pizza'] ;
?>
depending on what die(mysql_error()); gives me. I guess I'm just missing the big picture (such as when to use mysql_select, vs. mysql__fetch_array) and was wondering if there was a better resource to get some basic php knowledge other than the php manual. After searches, I either get the manual in German, or feel like its sentences are missing things like "verbs" or something. It's rough for us people just starting out.

thanks as alwaysr so, and I've almost figured out enough where I don't have to post problems every single day. I was wondering if someone could check out this code and see if there is a faster way to write it out. It's a basic query I use all the time, but just seems like a lot of lines if all I want is to get data from mysql columns individually.

Code: Select all

<?PHP
$pizzatastesgood = mysql_query("SELECT food FROM table WHERE food='$conqueso'") ; 
	$toomanypepperonis = mysql_fetch_array( $pizzatastesgood )
		or die(mysql_error()); 
?>
then sometimes i'm also doing things like

Code: Select all

<?PHP
$pizza = $toomanypepperonis['pizza'] ;
?>
depending on what die(mysql_error()); gives me. I guess I'm just missing the big picture (such as when to use mysql_select, vs. mysql__fetch_array) and was wondering if there was a better resource to get some basic php knowledge other than the php manual. After searches, I either get the manual in German, or feel like its sentences are missing things like "verbs" or something. It'ode and see if there is a faster way to write it out. It's a basic query I use all the time, but just seems like a lot of lines if all I want is to get data from mysql columns individually.

Code: Select all

<?PHP
$pizzatastesgood = mysql_query("SELECT food FROM table WHERE food='$conqueso'") ; 
	$toomanypepperonis = mysql_fetch_array( $pizzatastesgood )
		or die(mysql_error()); 
?>
then sometimes i'm also doing things like

Code: Select all

<?PHP
$pizza = $toomanypepperonis['pizza'] ;
?>
depending on what die(mysql_error()); gives me. I guess I'm just missing the big picture (such as when to use mysql_select, vs. mysql__fetch_array) and was wondering if there was a better resource to get some basic php knowledge other than the php manual. After searches, I either get the manual in German, or feel like its sentences are missing things like "verbs" or something. It's rough for us people just starting out.

thanks as always or so, and I've almost figured out enough where I don't have to post problems every single day. I was wondering if someone could check out this code and see if there is a faster way to write it out. It's a basic query I use all the time, but just seems like a lot of lines if all I want is to get data from mysql columns individually.

Code: Select all

<?PHP
$pizzatastesgood = mysql_query("SELECT food FROM table WHERE food='$conqueso'") ; 
	$toomanypepperonis = mysql_fetch_array( $pizzatastesgood )
		or die(mysql_error()); 
?>
then sometimes i'm also doing things like

Code: Select all

<?PHP
$pizza = $toomanypepperonis['pizza'] ;
?>
depending on what die(mysql_error()); gives me. I guess I'm just missing the big picture (such as when to use mysql_select, vs. mysql__fetch_array) and was wondering if there was a better resour It's a basic query I use all the time, but just seems like a lot of lines if all I want is to get data from mysql columns individually.

Code: Select all

<?PHP
$pizzatastesgood = mysql_query("SELECT food FROM table WHERE food='$conqueso'") ; 
	$toomanypepperonis = mysql_fetch_array( $pizzatastesgood )
		or die(mysql_error()); 
?>
then sometimes i'm also doing things like

Code: Select all

<?PHP
$pizza = $toomanypepperonis['pizza'] ;
?>
[ faster way to write it out. It's a basic query I use all the time, but just seems like a lot of lines if all I want is to get data from mysql columns individually.

Code: Select all

<?PHP
$pizzatastesgood = mysql_query("SELECT food FROM table WHERE food='$conqueso'") ; 
	$toomanypepperonis = mysql_fetch_array( $pizzatastesgood )
		or die(mysql_error()); 
?>
then sometimes i'm also doing things like

Code: Select all

<?PHP
$pizza = $toomanypepperonis['pizza'] ;
?>
depending on what die(mysql_error()); gives me. I guess I'm just missing the big picture (such as when to use mysql_select, vs. mysql__fetch_array) and was wondering if there was a better resource to get some basic php knowledge other than the php manual. After searches, I either get the manual in German, or feel like its sentences are missing things lp;quote;SELECT food FROM table WHERE food='$conqueso'") ;
$toomanypepperonis = mysql_fetch_array( $pizzatastesgood )
or die(mysql_error());
?&gt;

then sometimes i'm also doing things like

Code: Select all

<?PHP
$pizza = $toomanypepperonis['pizza'] ;
?>
depending on what die(mysql_error()); s individually.

Code: Select all

<?PHP
$pizzatastesgood = mysql_query("SELECT food FROM table WHERE food='$conqueso'") ; 
	$toomanypepperonis = mysql_fetch_array( $pizzatastesgood )
		or die(mysql_error()); 
?>
then sometimes i'm also doing things like

Code: Select all

<?PHP
$pizza = $toomanypepperonis['pizza'] ;
?>
depending on what die(mysql_error()); gives me. I guess I'm just missi to post problems every single day. I was wondering if someone could check out this code and see if there is a faster way to write it out. It's a basic query I use all the time, but just seems like a lot of lines if all I want is to get data from mysql columns individually.

Code: Select all

<?PHP
$pizzatastesgood = mysql_query("SELECT food FROM table WHERE food='$conqueso'") ; 
	$toomanypepperonis = mysql_fetch_array( $pizzatastesgood )
		or die(mysql_error()); 
?>
then sometimes i'm also doing things like

Code: Select all

<?PHP
$pizza = $toomanypepperonis['pizza'] ;
?>
depending on what die(mysql_error()); gives me. I guess I'm just missing the big picture (such as when to use mysql_select, vs. mysql__fetch_array) and was wondering if there was a better resource to get some basic php knowledge other than the php manual. After searches, I either get the manual in German, or feel like its sentences are missing things like "verbs" or something. It's rough for us people just starting out.

thanks as alwaysout 8 months or so, and I've almost figured out enough where I don't have to post problems every single day. I was wondering if someone could check out this code and see if there is a faster way to write it out. It's a basic query I use all the time, but just seems like a lot of lines if all I want is to get data from mysql columns individually.

Code: Select all

<?PHP
$pizzatastesgood = mysql_query("SELECT food FROM table WHERE food='$conqueso'") ; 
	$toomanypepperonis = mysql_fetch_array( $pizzatastesgood )
		or die(mysql_error()); 
?>
then sometimes i'm also doing things like

Code: Select all

<?PHP
$pizza = $toomanypepperonis['pizza'] ;
?>
depending on what die(mysql_error()); gives me. I guess I'm just missing the big picture (such as when to use mysql_select, vs. mysql__fetch_array) and was wondering if there was a better resource to get some basic php knowledge other than the php manual. After searches, I either get the manual in German, or feel like its sentences are missing things like "verbs" or something. It's rough for us people just starting out.

thanks as always
<?PHP
$pizzatastesgood = mysql_query("SELECT food FROM table WHERE food='$conqueso'") ;
$toomanypepperonis = mysql_fetch_array( $pizzatastesgood )
or die(mysql_error());
?>

then sometimes i'm also doing things like

Code: Select all

<?PHP
$pizza = $toomanypepperonis['pizza'] ;
?>
depending on what die(mysql_error()); gives me. I guess I'm just missing the big picture (such as when to use mysql_select, vs. mysql__fetch_array) and was wondering if there was a better resource to get some basic php knowledge other than the php manual. After searches, I either get the manual in German, or feel like its sentences are missing things like "verbs" or something. It's rough for us people just starting out.

thanks as always

Posted: Fri Jul 15, 2005 10:26 pm
by Burrito
I'm not sure what all of your questions are, but the ones I could tell I'll answer.

I don't know of a function called mysql_select...if you're referring to mysql_result then you'd use that if you want to "retrieve the contents of one cell from a MySQL result set". (right out of the manual).

you'd use an array if you're looking to pull down mulitple cells from multiple rows.

I personally don't see an advanage to ever useing mysql_result so I always just use an array (I use an associative array with mysql_fetch_assoc()).

I don't know of any better resources than the manual. you can always d/l it in a .chm format and then you don't have to worry about language issues.

another very good resource...umm...you're there right now :D

Posted: Sat Jul 16, 2005 9:29 am
by imstupid
thanks again- I'm sure it will all click one of these days. that was a good idea about the .chm format too.