Jump to content

Recommended Posts

I am making a simple guestbook using php and mysql. This code grabs an image using a database connection - eventually I will be using it as a captcha.

 

Everything works good on my home server running WAMP, but when I upload it to my website nothing will process past the mysqli_connect line (no php, no html, nothing). I asked customer service and mysqli is enabled.

 

Any ideas for a newbie?

 

Thanks in advance.

 

<?php

						$dbUser = "*****";
						$dbIP = "*****";
						$dbPwd = "****";

                                this line works -> echo "test 1234";

						$dbConnect = @mysqli_connect($dbIP, $dbUser, $dbPwd)
    							Or die("<p>Unable to connect to the database server.</p>" . "<p>Error Code " . mysqli_connect_errno() . ": " . mysqli_connect_error() . "</p>");

                              this line doesn't -> echo "test 1234";

						$dbName = "TravisH_captcha";

						if (!@mysqli_select_db($dbConnect, $dbName))
        							die("<p>Unable to connect to the database.</p>");

						$tableName = "images";
						$sqlString = "SELECT * FROM images ORDER BY RAND() LIMIT 1";
						$queryResult = @mysqli_query($dbConnect, $sqlString);
						$row = mysqli_fetch_assoc($queryResult);

						echo("<input type='text' size='3' maxlength='4' name='imageTextTb'></td><td><img src='{$row['imageLocation']}' class='img' alt='Please enter the text of this image into the text area on the left.' /></td>");
						echo("<input type='hidden' name='captcha' value='{$row['imageID']}'>");

						mysqli_free_result($queryResult);
						mysqli_close($dbConnect);
    					?>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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