mysql_fetch_array()
Posted by: Jippy (---.cable.ubr08.azte.blueyonder.co.uk)
Date: July 30, 2006 02:26PM

Right... I've just downloaded WAMP5 and created a relation. Here is the intension: ITEMTYPE(ItemType/char(50)). Pretty simple huh? I made one entry to the table.

Here is the index page:

<?php
$qry = "select * from ITEMTYPE";
$recordset = mysql_query($qry) or die( "query failed"winking smiley;
$row = mysql_fetch_array($recordset) or die( "fetch failed"winking smiley;
echo $row["ItemType"]
?>

And nothing happens. Not even an error message. Nothing. Help please?!? Note: This worked fine on my old version of apache1 and php4. (Which I was told to upgrade from cos $_POST didn't work very well... which it didn't)

I have been told to avoid php like the plague... is this a possible solution?

Options: ReplyQuote
Re: mysql_fetch_array()
Posted by: CyberSpatium (67.170.181.---)
Date: July 30, 2006 08:02PM

mysql fetch array returns an array, not a single value, so to make it work, you need to loop though the array. here is an example:

while ($row = mysql_fetch_array($recordset)) {
printf("Item Type: %s", $row[0]);
}

Options: ReplyQuote
Re: mysql_fetch_array()
Posted by: Jippy (---.cable.ubr08.azte.blueyonder.co.uk)
Date: July 31, 2006 07:36PM

Still no joy. I don't think the problem is with the code as the follow code also does nothing:

echo "it works"

Help please!!!

Options: ReplyQuote
Re: mysql_fetch_array()
Posted by: Jippy (---.cable.ubr08.azte.blueyonder.co.uk)
Date: July 31, 2006 07:43PM

Also, should the following code work:
I've missed out the ?.

<php
if ($_POST['PASSWORD'] == 'password') {
php>
<p>If the conditional satement is true then this is printed</p>
<php
}
php>

Options: ReplyQuote
Re: mysql_fetch_array()
Posted by: CyberSpatium (67.170.181.---)
Date: August 01, 2006 03:47AM

<php
if ($_POST['PASSWORD'] == 'password') {
?>
<p>If the conditional satement is true then this is printed</p>
<php
}
?>

Options: ReplyQuote
Re: mysql_fetch_array()
Posted by: Jippy (---.cable.ubr08.azte.blueyonder.co.uk)
Date: August 01, 2006 07:49PM

Thanks!



Post Edited (08-01-06 20:01)

Options: ReplyQuote


Sorry, only registered users may post in this forum.