Jump to content

UziLok

Members
  • Posts

    11
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

UziLok's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Whats the difference ? $this->mydb['pass'] = $pass; $this->pass = $pass;
  2. i get string string(102) outside from any (IF, ELSE IF etc) maybe take out the the where id part and just use like that ? ..
  3. when i do $listUsers = readUsers(1); instead of $id i get back a row, but as suspected only one. :S on var dump, i get string(0); when run on $id
  4. code update!. function readUsers($id) { $sql = sprintf("SELECT * FROM `crud_` WHERE `id` = %d", (int)$id); $res = @mysql_query($sql) or die(mysql_error()); if ($res) { $output = ''; while ($row = mysql_fetch_array($res, MYSQL_ASSOC)) { $output .= "First Name :{$row['fname']} <br>" . "username :{$row['uname']} <br>" . "email : :{$row['email']} <br>" . "phone :{$row['phone']} <br>"; } return $output; }else{ return false; } }
  5. it's the ending of the one up () and i think you know what mysql_real_escape_string is
  6. hello, well as you can see here: got my function, function readUsers($fname, $uname, $email, $phone) { $sql = sprintf(" SELECT * FROM `crud_` WHERE `id` = '%s'", mysql_real_escape_string($id)); $res = @mysql_query($sql) or die(mysql_error()); if ($res) { $output = ''; while ($row = mysql_fetch_array($res, MYSQL_ASSOC)) { $output .= "First Name :{$row['fname']} <br>" . "username :{$row['uname']} <br>" . "email : :{$row['email']} <br>" . "phone :{$row['phone']} <br>"; } return $output; }else{ return false; } } and then to output it in a page called showusers i have like this <?php include "crud_functions.php"; connect($conn); selectDB($conn, $dbname); //list users $listUsers = readUsers($fname, $uname, $email, $phone); echo $listUsers; ?> and the problem is that showusers turns blank.. so i need some help to understand why, might have missed something in the code as i tend to code fast when i am on a roll Thank you for the help in advance! ???
×
×
  • 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.