FlySince9
En-Route
Anybody out there fluent in PHP and mysql that I can private message and ask a few questions???
I'm pretty good in SQL...
I'm assuming that the connect is successful?
What's the first result that would be returned?
Rich
$query="SELECT * FROM /main";
$result=mysql_query($query);
$first0 = mysql_result($result,0,"FirstName");
$last0 = mysql_result($result,0,"LastName");
I'm not a big fan of " SELECT * " myself. But that's neither here nor there.
I don't claim to be anything more than an amateur... I used toThat wouldn't pass the first set of eyeballs in a code review at our place. Might even become the source of much ribbing and wondering if you were high on something when you wrote it. And that's from the sysadmins.
The coders and DBAs might ask if a rope and a chair and a solid rafter were handy back in the warehouse.
I'm just going to link this here.
https://www.binpress.com/tutorial/using-php-with-mysql-the-right-way/
It's just the first "decent" example I found of DB abstraction and not writing SQL Injection directly into your PHP script...
There's plenty more examples. Just the tip of this iceberg, really.
The SELECT isn't the only big no-no in your script.
God forbid you have a database error and have high debugging errors turned on in PHP or Apache when that things fails someday when the DB is offline. Instant publish of your DB password without anyone even trying hard.
Think like a bad guy, or they'll do it for you.
I don't claim to be anything more than an amateur... I used to
do pretty good muddling through this stuff, but its been a long time and I seem to be starting from scratch in my understanding... All of it is self-taught from trial and error, and consequently, there are, as you can see, more errors than anything... And self taught automatically means they'll be some unconventional stuff going on... but at my level, as long as it works, I'm a happy camper...
That wouldn't pass the first set of eyeballs in a code review at our place. Might even become the source of much ribbing and wondering if you were high on something when you wrote it. And that's from the sysadmins.
Code review...documentation....good query form...meh. If it was difficult to write it ought to be difficult to understand.
Are there DBAs for MySQL?