By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,631 Members | 826 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,631 IT Pros & Developers. It's quick & easy.

Resource id #4

P: 3
Hi all,

i'm a new user of PHP,

at the moment, i have queries regarding the "Resource id #4"

everythings run perfectly but before the script showing the result,
it shows the "Resource id #4" in front of the result, and i don't have any clue what happend with it.

Could someone please help me with it.

thanks a lot,
regards,
adi

here is my code:
Expand|Select|Wrap|Line Numbers
  1.     <?php
  2.       require_once('dbconnect.php');         
  3.       $trackID = $_GET['TrackId'];      
  4.       $trackName = mysql_query("SELECT TrackName FROM EHAC_track where TrackId='$trackID'");
  5.       $meetingList = mysql_query("SELECT MeetingID, MeetingDate FROM EHAC_meeting WHERE TrackId='$trackID' ORDER BY MeetingDate");
  6.     ?>
  7.  
  8.           <ul>
  9.             <?php
  10.               error_reporting(E_ALL);
  11.               ini_set('display_errors', true);
  12.               Echo $trackName;
  13.               $count = 0;
  14.               while ($row = mysql_fetch_array($meetingList)) {
  15.                 Echo "<li><a href=raceInformation.php?MeetingID=".$row['MeetingID']." class=\"item-link-1\">".$row['MeetingDate']."</a></li>";                         
  16.                 $count++;
  17.               }
  18.               if($count==0){
  19.                 Echo "<span class=\"header-2\">No date available on this track</span>";
  20.               }
  21.             ?>
  22.           </ul>
Dec 16 '07 #1
Share this Question
Share on Google+
6 Replies


Markus
Expert 5K+
P: 6,050
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. require_once('dbconnect.php');
  3. $trackID = $_GET['TrackId'];
  4. $trackName = mysql_query("SELECT TrackName FROM EHAC_track where TrackId='$trackID'");
  5. $meetingList = mysql_query("SELECT MeetingID, MeetingDate FROM EHAC_meeting WHERE TrackId='$trackID' ORDER BY MeetingDate");
  6.  
  7. //instead of stopping the parsing of php just echo-out the <ul>
  8. echo "<ul>";
  9.  
  10. error_reporting(E_ALL);
  11. ini_set('display_errors', true);
  12.  
  13. //this is the problem line
  14. Echo $trackName;
  15. $count = 0;
  16. while ($row = mysql_fetch_array($meetingList)) {
  17. Echo "<li><a href=raceInformation.php?MeetingID=".$row['MeetingID']." class=\"item-link-1\">".$row['MeetingDate']."</a></li>";
  18. $count++;
  19. }
  20. if($count==0){
  21. Echo "<span class=\"header-2\">No date available on this track</span>";
  22. }
  23. ?>
  24.  
Line 14 is the problem.
You need to use one of the provided mysql functions
i.e:
Expand|Select|Wrap|Line Numbers
  1. while($track = mysql_fetch_array($trackName)){
  2.     echo $track;
  3. }
  4.  
Hope this helps :)
Dec 16 '07 #2

P: 3
hi,

i have tried it, and you are correct that the problem is from line 14 but after i implement it, it shows "array" instead of "resource id#4".

i don't know why it shows array now.
i'm really sorry to ask a lot of question because i'm really new in here and this is my assignment for my uni.

thanks for the help.
regards,
adi
Dec 16 '07 #3

Markus
Expert 5K+
P: 6,050
Sorry, i forgot a bit of it.

Expand|Select|Wrap|Line Numbers
  1. while($track = mysql_fetch_array($trackName)){
  2.     echo $track;
  3. }
  4.  
needs to be

Expand|Select|Wrap|Line Numbers
  1. while($track = mysql_fetch_array($trackName)){
  2.     echo $track[*table_row_name*];
  3. }
  4.  
*table_row_name* needs to be substituted with the appropriate row name.
:)
Dec 16 '07 #4

P: 3
You are the star Markus :)

thank you very much for your help.

and i might need your help in the near future as i just started my assignment and i believe i will face a lot of trouble in this because i don't have IT background.

once again,

thank you.
regards,
adi
Dec 16 '07 #5

Markus
Expert 5K+
P: 6,050
No problem at all :)

post back whenever you need some help

also, remember to use CODE tags when posting - it helps us work through your code.

-markus
Dec 16 '07 #6

P: 1
Hi Markus - Could u plz rectify my code as well??

Expand|Select|Wrap|Line Numbers
  1. <?php
  2.  
  3. if (isset($_POST['verifyotp'])) {
  4.  
  5.     // Authorisation details.
  6.     $username = "foo@bar.foobar";
  7.     $hash = "01993a995a047af1dfe20536da550cf101e571c9f7ba4a05bd6638417d79455f";
  8.  
  9.     // Config variables. Consult http://api.textlocal.in/docs for more info.
  10.     $test = "0";
  11.     $numbers = $_POST['otpnumber'];
  12.  
  13.     // Data for text message. This is the text message data.
  14.     $sender = "TXTLCL"; // This is who the message appears to be from.
  15.     $numbers = $_POST['otpnumber']; // A single number or a comma-seperated list of numbers
  16.     $otp = mt_rand(100000,999999);
  17.     setcookie("otp", $otp);
  18.     $message = "Dear Subscriber Your OTP is ".$otp;
  19.     // 612 chars or less
  20.     // A single number or a comma-seperated list of numbers
  21.     $message = urlencode($message);
  22.     $data = "username=".$username."&hash=".$hash."&message=".$message."&sender=".$sender."&numbers=".$numbers."&test=".$test;
  23.     $ch = curl_init('http://api.textlocal.in/send/?');
  24.     curl_setopt($ch, CURLOPT_POST, true);
  25.     curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
  26.     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  27.     $result = curl_exec($ch); // This is the result from the API
  28.  
  29.     curl_close($ch);
  30.  
  31.     if ($ch) {
  32.         echo "CURL Error #: " .$ch;
  33.     }
  34.     else
  35.     {
  36.         $json = json_decode($result);
  37.  
  38.         if ($json->type == 'success') 
  39.         {
  40.             header('location: otpverified.php');
  41.         }
  42.         if ($json->type == 'error') 
  43.         {
  44.             echo 'Your OTP is not Verified "'.$json->message.'" ';
  45.         }    
  46.  
  47. }
  48.  
  49. }
  50.  
  51. ?>
Jul 5 '19 #7

Post your reply

Sign in to post your reply or Sign up for a free account.