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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.