Jump to content

Aido89

Members
  • Posts

    9
  • Joined

  • Last visited

Posts posted by Aido89

  1. Hi

     

    I am getting the error below;

    Warning: mysql_fetch_array() expects parameter 1 to be resource, object given in C:\xampp\htdocs\getuser.php on line 17

     

    See below the code i am using, i also have an ajax file for this but that is working 100% the issue lies in the code below.

     

    Any ideas?

    <?php
    $q=$_GET["q"];
    
    $con = mysqli_connect('localhost','root','','db');
    if (!$con)
      {
      die('Could not connect: ' . mysqli_error($con));
      }
    
    mysqli_select_db($con,"db");
    $sql="SELECT * FROM db WHERE id = '".$q."'";
    
    $result = mysqli_query($con,$sql);
    
    
    
    while($row = mysql_fetch_array($result))
      {
      echo "<tr>";
      echo "<td>" . $row['item'] . "</td>";
      echo "<td>" . $row['description'] . "</td>";
      echo "<td>" . $row['price'] . "</td>";
      echo "<td>" . $row['category'] . "</td>";
      echo "<td>" . $row['paypal'] . "</td>";
      echo "</tr>";
      }
    echo "</table>";
    
    mysqli_close($con);
    ?>
    
  2. Hi 

     

    I have tried this but the same error keeps appearing I'm afraid

     

    Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given inC:\xampp\htdocs\readmore.php on line 68

    <?php
    	   
    	    mysql_connect("localhost","root","");
     mysql_select_db("db");
     
    
     $id = intval($_GET['id']);
    
    $sql = "SELECT * FROM table WHERE id=$id";
    $res = mysql_query($sql);
    
     /*
     $res = "SELECT * FROM table WHERE id=".intval($_REQUEST['id']);*/
     /*$res=mysql_query ("select * from table");*/
     
     echo "<table>";
     
    $row = mysql_fetch_assoc($res);
    {
     echo "<tr>";
     
     echo "<td>"; echo "<h4>".$row['item']."</h4>"; echo "</td>";  echo "</tr>";
     echo "<td>";?> <img src ="<?php echo $row['image']; ?>" height ="100" width ="100"> <?php echo "</td>"; echo "</tr>";
     
      echo "<td>"; echo $row['description']; echo "</td>"; echo "</tr>";
       echo "<td>"; echo $row['price']; echo "</td>";
    
     echo "</tr>";
     
     }
     
     echo"</table>";
     
     ?>
    
  3. Hi I have added in $row = mysql_fetch_assoc($res); as seen below but am now getting following error, Warning: mysql_fetch_assoc() expects parameter 1 to be resource, string given in

     

    Thanks again for fast replies guys, much appreciated

    <?php
    	   
    	    mysql_connect("localhost","root","");
     mysql_select_db("db");
     
    
     $id = intval($_GET['id']);
    $res = "SELECT * FROM table WHERE id=$id";
    
    
     /*
     $res = "SELECT * FROM shoes WHERE id=".intval($_REQUEST['id']);*/
     /*$res=mysql_query ("select * from shoes");*/
     
     echo "<table>";
     
    $row = mysql_fetch_assoc($res);
    {
     echo "<tr>";
     
     echo "<td>"; echo "<h4>".$row['item']."</h4>"; echo "</td>";  echo "</tr>";
     echo "<td>";?> <img src ="<?php echo $row['image']; ?>" height ="100" width ="100"> <?php echo "</td>"; echo "</tr>";
     
      echo "<td>"; echo $row['description']; echo "</td>"; echo "</tr>";
       echo "<td>"; echo $row['price']; echo "</td>";
    
     echo "</tr>";
     
     }
     
     echo"</table>";
     
     ?>
    
  4. Hi 

     

    Please see code below, when I query my db I am getting an unefined variable issue, any ideas?

     

    I am quiet new to PHP so please help.

     

     mysql_connect("localhost","root","");
     mysql_select_db("db");
     
     $id = intval($_GET['id']);
    $res = "SELECT * FROM table WHERE id=$id";
     
     
     
     
     echo "<table>";
     
     
     echo "<tr>";
     
     echo "<td>"; echo "<h4>".$row['item']."</h4>"; echo "</td>";  echo "</tr>";
     echo "<td>";?> <img src ="<?php echo $row['image']; ?>" height ="100" width ="100"> <?php echo "</td>"; echo "</tr>";
     
      echo "<td>"; echo $row['description']; echo "</td>"; echo "</tr>";
       echo "<td>"; echo $row['price']; echo "</td>";
     
     echo "</tr>";
     
     
     
     echo"</table>";
     
     ?>
  5. Hi

     

    I have a contact page uploaded on my website.

     

    This is called contact.html, when the details are entered it picks up sendmail.php which sends the email

     

    However this works on my localhost as I get the e-mail to my outlook & hotmail account but not since I have hosted it as a live website.

     

    I am wondering is there a php conflict with the versions, I am on version 5.3.5.

     

    Can you provide any assistance with this please?

     

    The code for the sendmail.php file is below;

     

    <?

    $email = $_POST['email'] ;

    $q = $_POST['q'] ;

    $message = $_POST['message'] ;

    mail( "test@myemail.com", $q, $message, "From: $email" );

    print "Thank you for your e-mail, we will get in touch with you as soon as possible, have a nice day.";

    ?>

    Thanks,

    Aidan

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