cant take a data from row variable
the following code can't take my data from database. what could be the problem. here's the sample code:
There's seems to be no problem or error message. when i try to replace $row['mrisno'] with $row it works well. But i want it to be a fieldname not a number for me not to have a hard coding but this isn't working. what seems to be the problem? thank you in advance for any information guys..
mysql_connect('localhost','root','1234') or die("Unable to connect to MySQL");
mysql_select_db(mris) or die("Unable to select a database");
$query = "select mrisno,mdate from mrishead where mdate<'$datestart' and status='Approved' and appname<>'' and lastupdate>='$datestart'"
$result = mysql_query($query) or die("Error in query");
instead of using mysql_fetch_row($result) it should be mysql_fetch_array($result). I got it now.. =)
Or mysql_fetch_assoc(), which might be nano-seconds faster and save a couple bytes of memory if you are only going to use the named (associative) array keys.
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
How to Ask Questions the Smart Way
(not affiliated with this site, but well worth reading)
wow..thanks for that advice..ill try it..=)
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)