Jump to content

Chalupabatman

New Members
  • Content Count

    4
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Chalupabatman

  • Rank
    Newbie
  1. @Barand - that worked perfectly. Thank you so much!
  2. Sorry that was a direct pull from the link you provided. My variable is $result so it would be something like foreach($result as $res){ echo $res; }
  3. @Barand - so if I am following the tutorial you linked to, I need to do foreach($services as $service){ echo $service; //work properly, cause it implements Iterator } in my code. Now my question is, how would I assign all of the returned results (fields and rows) to an array in this foreach loop?
  4. Hello - I am connecting to MySql and running a query. If I use a foreach loop, I can iterate over the results and have them print to screen. However, when I try the below everything is null! How can I add the results of my MySql query to a php array? <?php $con=mysqli_connect("site", "user", "psasswr=ord", "db"); if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } $sql="SELECT * FROM test LIMIT 10"; $result = mysqli_query($con,$sql); echo json_encode($result); mysqli_free_result($result); mysqli_close($con); ?> but what this prints is: {"current_field":null,"field_count":null,"lengths":null,"num_rows":null,"type":null}
×
×
  • 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.