Jump to content

solidrocketfuel

New Members
  • Posts

    5
  • Joined

  • Last visited

solidrocketfuel's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Sorry for being such a newbie guys. Just fixed the single echo with a while loop. But the only problem is that the comma between echos is not work. My result is: "_IvF4X658hY""DRF6b1N_KFk""G-keFAKQHy4" My code: $sql = 'SELECT video_code FROM yt_videos WHERE yt_video_item_id="'.$vidid.'" ORDER BY RAND() LIMIT 10'; $result=mysqli_query($db_conx,$sql); // Associative array while ( $row = mysqli_fetch_assoc($result)) echo '"' . join('","', $row) . '"'
  2. Thanks Fastol. That helped. Now its only echoing one result. Here is my code now. No errors!! Getting close! $sql = 'SELECT video_code FROM yt_videos WHERE yt_video_item_id="'.$vidid.'" ORDER BY RAND() LIMIT 10'; $result=mysqli_query($db_conx,$sql); // Associative array $row = mysqli_fetch_assoc($result); echo '"' . join('","', $row) . '"';
  3. Ok I tried the join function but now I am getting an error: Warning: join() [function.join]: Invalid arguments passed in... Here is my code. I just don't understand mysqli, I just have some experience and mysql. $sql='SELECT video_code FROM yt_videos WHERE yt_video_item_id="'.$vidid.'" ORDER BY RAND() LIMIT 10'; $result=mysqli_query($db_conx,$sql); mysqli_free_result($result); echo '"' . join('","', $result) . '"';
  4. Thanks for the reply. I don't quite understand how to implement the join function in my code. I think I am close other wise as I am no longer getting an error but not quite the result I need. When I use this code it works: $list.= $result->video_code.'",'; Resulting in 2343234",345353",43533534" How do I write that line to include a " before each row result too. Looking for "2343234","345353","43533534" Thanks.
  5. Hello, I am new to php and stuck on this msqli function. I would like to echo out all the results divided by commas and apostrophe. Example: "23232","324231","342533" With the last one not having a comma. Here is what I came up with and not sure why I am getting errors. I think this is the issue but not sure: $list.= $result->'"'.video_code.'",'; Thanks. $sql = 'SELECT video_code FROM yt_videos WHERE yt_video_item_id="'.$vidid.'" ORDER BY RAND() LIMIT 10'; $query = mysqli_query($db_conx, $sql); $list=''; while ($result = $query ->fetch_object()) { $list.= $result->'"'.video_code.'",'; } echo $list=substr($list,0,-1);
×
×
  • 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.