By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.

    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

PHP Newbie Here


New Coder
Before PHP 8 my website was working as expected. After PHP 8 my website had a few minor bugs in it. And since I"m new, I'm wondering if someone from here can help me out. I have the database open :). Now what I would like to do is going into a table and check if the table has any information in it. If it doesn't have any information, to print "No Information Found" and move on to the next coding. If there is information there, please print it in a while loop.

The coding I have is following:
$Query = "Select id from ticketinfo where box1 = '' ";
if($result = mysql_query($Query)) {
if ( mysql_num_rows($result) == 0 ) {
    echo "No Information Found";
if($stmt = $mysqli->query("SELECT box1, FROM ticketinfo WHERE username = '$username' ORDER BY drawingdate")){ 
 echo "<table border='1'>
    <th>Box #1</th>

    while ($row = $stmt->fetch_assoc()) {
    echo "<tr>";
    echo '<td align="center">' . $row['box1'] . "</td>";
    echo "</tr>";
Thank you for your help in advance.
Last edited by a moderator:
Do you have control over the PHP ver you are using? If yes I'd just go back to the old version. If you want the upgrade you need to turn error reporting on to see the errors. Here is what to place in your code to do that:
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
Then troubleshoot.
in addition, as your application grows, you might like the flexibility (when it comes to which database server you're using) of ADOdb - Database Abstraction Layer for PHP [ADOdb]

and you'll also need a more robust error routing method than mere output (of HTML!) to your browser.
i know this from time-consuming personal experience.

boot.php / startup.php :

$naDebugAll = true;
global $naDebugAll;
if ($naDebugAll) {
    ini_set('display_errors', 1); // 0 == false, 1 == true
    ini_set('display_startup_errors', 1);

    global $naBypassMainErrorHandler;
    if (!isset($naBypassMainErrorHandler) || $naBypassMainErrorHandler)
        $old_error_handler = set_error_handler ('mainErrorHandler');

    global $mainErrorLogFilepath; global $mainErrorLogLastWriteFilepath;
    $mainErrorLogFilepath = realpath(dirname(__FILE__)).'/siteLogs/error.'.date('Y-m-d_H.i.s').'.html.log';
    $mainErrorLogLastWriteFilepath = realpath(dirname(__FILE__)).'/siteLogs/error.'.date('Y-m-d_H.i.s').'.lastModified.txt';
ini_set ('log_errors', true);

mainErrorHandler() :

also, you might want to take a look at my freely usable (even commercially, MIT-licensed) universal database PHP drivers and logging facilities at :


adodb support will be added in version 6 of my software; (all versions are entirely free to use and modify)

and finally, you'll need a different logging mechanism for PHP and JS.
trust only the results that JS sends you and which don't have a useragent that matches the regex /.bot./
but do occasionally view the PHP log as well. it'll tell you what the hackers are up to ;)
Last edited:

New Threads

Buy us a coffee!

Top Bottom