Jump to content

Small Syntax Question


Solarpitch

Recommended Posts

Hey,

 

Is there an reason why the value of $row[4] below will not assign its value to the array? When I try to print the value out noting will display but when I hard code in a test value... $myinfo[1] = "test"; that will print out fine.

 


<?php

        ...

dbconnect();

$myinfo = array();

$sql = "select * from golfpro_time_sheet where realdate= '".$teedate."' and slots < ".$players."";
$row = mysql_fetch_row($sql);

$myinfo[1] = $row[4];

        return $myinfo;

        ...

?>


Link to comment
https://forums.phpfreaks.com/topic/96680-small-syntax-question/
Share on other sites

You're syntax is fine. What's in $row[4]?

 

do a

<?php
echo '<pre>' . print_$($row,true) . '</pre>';
?>

after the mysql_fetch_array()

 

BTW, you might want to use the mysql_fetch_assoc() function instead, then you can use the field names as array indexes.

 

Ken

Link to comment
https://forums.phpfreaks.com/topic/96680-small-syntax-question/#findComment-494736
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.