Jump to content

westman

Members
  • Posts

    600
  • Joined

  • Last visited

Everything posted by westman

  1. westman

    Javascript in PHP

    Last piece of the puzzle. I have coded everything and It works well apart from one aspect "JavaScript in php" the title of this post. this is what I have. $text = strip_tags($text); $text = str_replace("`", "\'", $text); $text = str_replace("'", "\'", $text); $text = str_replace('"', "\'", $text); $text = preg_replace("/[\n\r]/","<br />",$text); $text_div = $text; $subject_all_show .= ' <div align="left" style="background-color:#FFF;"> <div class="link_black" style="padding-top:10px; padding-left:5px; float:left;"> <a href = "javascript:void(0)" onclick = "document.getElementById(\'mail\').style.display=\'block\';document.getElementById(\'fade\').style.display=\'block\';document.getElementById(\'subject\').innerHTML=\''.$subject.'\';document.getElementById(\'mail_text\').innerHTML=\''.$text_div.'\';">subject</a> </div> <div style="float:right; padding-top:10px; padding-right:5px;"> date </div> <div style="clear:both;"></div> </div> <br /> '; This works fine. but when I change $text_div = $text; to $text_div .= ' <div style="clear:both;"></div> '.$text.' </div>'; There is a problem. How do I fix it as I need to add css to different divs in the while loop.
  2. westman

    Javascript in PHP

    Thank you. Then I am going to use 1 php file (main page) to do all the work. There will be no page reloading as I am looping everything from the DB. first loop is message subject and inside that loop is a sub-loop to get the messages of all subjects. I am sacrificing page load time for not reloading the page.
  3. westman

    Javascript in PHP

    Before I go ahead and start coding this I need some advice on functionality. I don't know if I should run everything from my main page or use AJAX to call on a second php file. So this I what I am programming. An inbox page like google. From pic1.PNG you can see my layout. Once you click on the subject a div will show with the message history. I will be taking all the info from my DB and creating more divs in php to dynamically echo to the popup div. The problem... JavaScript does not like my content ie ' " and line brakes. If I have a second php file using AJAX would it work better?
  4. westman

    Javascript in PHP

    where do I start with this code?
  5. westman

    Javascript in PHP

    the idea is this $id1 = '123'; $id2 = '123'; $text =' <a class="link" href = "javascript:void(0)" onclick = "document.getElementById(\'test.php\').innerHTML=\''.$id1.'\';document.getElementById(\'test.php\').innerHTML=\''.$id2.'\';">Text</a> '; then test.php will echo back information to the main page.
  6. westman

    Javascript in PHP

    Using the same script at the top of this post. How do I send the info to a php file instead of a div?
  7. hourly is working fine but just tested daily and it is not working. Why?
  8. westman

    Javascript in PHP

    thank you so much. Very helpful.
  9. westman

    Javascript in PHP

    $string = 'Hello and hi'; $text =' <a class="link" href = "javascript:void(0)" onclick = "document.getElementById(\'text_div\').innerHTML=\''.$string.'\';">Text</a> '; This is code I am using to print $string in text_div. What syntax (characters) can I not pass through this script?
  10. I don't know what happened but I sent the cron job to run every hour and it works fine. Now I am going to test it for daily as that is what I need.
  11. I have nothing in my error log. How do I forces my cron job to log all actions using my cron job command?
  12. I put mysite/public_html/scripts/cron_day.php in my browser to run the code. It worked with no problem. I even looked for errors with this code error_reporting(E_ALL); ini_set('display_errors', '1'); There are no errors with the php file. The cron job itself is not working. Why?
  13. Hi there, I made a cron job on godaddy and it worked for the first two days and now it is no longer working. Here is my code. 0 10 * * * /usr/local/bin/php -q /home/mysite/public_html/scripts/cron_day.php Why did it stop working? What did I do wrong?
  14. westman

    using OR in MySQLi

    It works very well. thank you so so so so much
  15. westman

    using OR in MySQLi

    then, would this work? $Db1 = "1"; $Db2 = "2"; $Dbseen = "yes"; $stmt = $conn->prepare("SELECT id, user, title, date, show_post FROM post WHERE show_post = ? AND seen = ? OR show_post = ? AND seen = ? ORDER BY id DESC"); $stmt->bind_param("ssss", $Db1, $Dbseen, $Db2, $Dbseen); ???
  16. westman

    using OR in MySQLi

    as I would like to use AND and OR together, would this work? $Db1 = "1"; $Db2 = "2"; $Dbseen = "yes"; $stmt = $conn->prepare("SELECT id, user, title, date, show_post FROM post WHERE show_post = ? AND seen = ? OR show_post = ? AND seen = ? ORDER BY id DESC"); $stmt->bind_param("sss", $Db1, $Dbseen, $Db2);
  17. westman

    using OR in MySQLi

    how do I use "OR" in MySQLi? Here is what I have $i = 0; $Db1 = "1"; $Db2 = "2"; $stmt = $conn->prepare("SELECT id, user, title, date, show_post FROM post WHERE show_post = ? ORDER BY id DESC"); $stmt->bind_param("s", $Db1); $stmt->execute(); $stmt->store_result(); //if($stmt->num_rows === 0) exit('No rows'); $stmt->bind_result($idRow, $userRow, $titleRow, $dateRow, $showRow); while ($stmt->fetch()) { $post_id[] = $idRow; $user[] = $userRow; $title[] = $titleRow; $date[] = $dateRow; $post_show[] = $showRow; $i++; // run a while loop } $stmt->close(); $conn->close(); I would like to use OR to look for $Db1 = "1"; $Db2 = "2"; in my DB. How do I use OR?
  18. westman

    numRows

    could you give a link please
  19. westman

    numRows

    how do I do the count query?
  20. westman

    numRows

    It will not show me the error message. There is more than one of the same email in the data base.
  21. westman

    numRows

    My code is not working, here it is... $stmt = $conn->prepare("SELECT id FROM users WHERE email = ?"); $stmt->bind_param("s", $email); $stmt->execute(); $numRows = $stmt->num_rows; $stmt->close(); if($numRows > 0) { $error = "Your Email is already in use. Please try another."; $conn->close(); }else{ // all good $conn->close(); } any help?
  22. Thank you so much. So so so helpful. Image security helps big time. Happy holidays
  23. lol that gave me the output of the longest url I have ever seen. Thank you. Question. Can it be decoded?
×
×
  • Create New...