Jump to content

westman

Members
  • Content count

    591
  • Joined

  • Last visited

Community Reputation

10 Good

About westman

  • Rank
    Invested Member
  1. westman

    array in mysqli query

    Thank you. Last question. If I have my usual $conn = new mysqli($db_host, $db_username, $db_pass, $db_name); in an external file would it be a problem if I add $conn_pdo = new PDO("mysql:host=$servername2;dbname=$dbname2", $username2, $password2); in the same file?
  2. westman

    array in mysqli query

    I removed one LIMIT and it is okay now. how do I close the PDO query and and connection?
  3. westman

    array in mysqli query

    this is my output from print_r($stmt);. PDOStatement Object ( [queryString] => SELECT id, main, id_from, id_to, pm_subject, pm_text, pm_date, pm_open FROM text WHERE id IN (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) ORDER BY id DESC LIMIT LIMIT 0,10 ) Fatal error: Uncaught PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'LIMIT 0,10' at line 1 in /home/outlinetalent/public_html/t_all.php:86 Stack trace: #0 /home/mysite/public_html/file.php(86): PDOStatement->execute(Array) #1 {main} thrown in /home/mysite/public_html/file.php on line 86
  4. westman

    array in mysqli query

    the output of $limit = 'LIMIT ' .($pagenum - 1) * $page_rows .',' .$page_rows; echo "<br /> limit: $limit <br />"; is... limit: LIMIT 190,10
  5. westman

    array in mysqli query

    thank you for the $row info. it tried... $limit = 'LIMIT ' .($pagenum - 1) * $page_rows .',' .$page_rows; but got the following error
  6. westman

    array in mysqli query

    works well. thank you. last one. How do I get a variable out the while loop and how do I close the DB connection? Also, is it possible for $limit = 5; to be $limit = "34,5"; as it is a pagination script. PDO is new to me.
  7. westman

    array in mysqli query

    using.... echo $result; my output is 1
  8. westman

    array in mysqli query

    Thank you for your support. I really appropriate it. I am having a problem with this line... while($row = $result->fetch(PDO::FETCH_ASSOC)) {
  9. westman

    array in mysqli query

    $seach = ''; foreach ($uniqueValueArray_id as $key => $value) { $seach .= 'id='.$value; $seach .= ' OR '; } $seach = rtrim($seach,' OR '); echo $seach; $sql = "SELECT id, text, date, FROM text WHERE $seach ORDER BY id DESC $limit"; $query = mysqli_query($conn, $sql); I am getting closer but I do have a problem with the query still. Any help?
  10. westman

    array in mysqli query

    Is it even possible to run an array through a query?
  11. westman

    array in mysqli query

    $uniqueValueArray[] = $mainRow; // my array $sql = "SELECT id, text, date FROM text WHERE id='My Array' ORDER BY id DESC $limit"; $query = mysqli_query($conn, $sql); How do I make a query look for an array?
  12. westman

    user agreement

    Hi all, No PHP or cookies today just text. I would like to update my Terms of Use / User Agreement - legal page. I am terrible with page content like this and would like to use a good free template. Where do I go for this?
  13. westman

    cookie coding

    Thank you for the answer to my question. Most of what you were discussing I did not follow but thanks.
  14. westman

    cookie coding

    In my last topic i opened It was advised to have a new cookie and never use the same one. At the moment my code is setting a new cookie with each page view after being logged in. Is this too excessive?
  15. westman

    cookie coding

    Hi Foxy, Thank you very much for your contribution. I was really quite advance for me but I am sure it wasn't lost on others. In the end I added one more line of code to fix the problem - It probably didn't fix the problem but no errors are show to the page and the cookie gets killed. if (isset($_GET['active'])) { $active = $_GET['active']; if ($active == "logout"){ if(isset($_COOKIE["username"])){ setcookie("username", '', strtotime( '-5 days' ), '/'); } session_destroy(); echo "<script>setTimeout(\"location.replace('http://mysite.com')\",1000)</script>"; exit(); } } as you can see a just added "exit();"
×