Publishing MySQL Data on the Web

I’m glad our suggestions did help you out. If you can help out the next person looking for similar advice that would be great.

oh course i will

does most people use WAMP

*AMP(P) programs are quite common. I personally use XAMPP for my local development (And I do run a local directory named “sitepoint” which has about 50 PHP files in it just of stuff our users have said doesnt work).

As has been said, unless you’re going to be a server administrator, the ins and outs of running the software is likely unnecessary. (Note: Knowing how to modify php.ini, however, may be useful.)

<?php
$link = mysqli_connect('localhost', 'root', 'nestle324');
if (!$link)
{
    $error = 'Unable to connect to the database server.';
    include 'error.html.php';
    exit();
}

if (!mysqli_set_charset($link, 'utf8'))
{
    $output = 'Unable to set database connection encoding.';
    include 'output.html.php';
    exit();
}

if (!mysqli_select_db($link, 'ijdb'))
{
    $error = 'Unable to locate the joke database.';
    include 'error.html.php';
    exit();
}

$result = myslqi_query($link, 'SELECT joketext FROM joke');
if (!$result)
{
    $error = 'Error fetching jokes: ' . mysqli_error($link);
    include 'error.html.php';
    exit();
}

while ($row = mysqli_fetch_array($reesults))
{
    $jokes[] = $row['joketext'];
}

include 'jokes.html.php';
?>

i keep getting this error:

( ! ) Fatal error: Call to undefined function myslqi_query() in C:\wamp\www\listjokes\index.php on line 24
Call Stack
#-----Time-------Memory-------Function---------Location
1------0.0009----679160------{main}( )--------…\index.php:0

How do i find errors in the mist of the code everything looks correct but there is something wrong?

Looks like back to your original problem.

Do what Mandes has suggested and let us know what you got.

Its all worKing but I couldn’t figure out a typo in the code So I just ended up retyping the whole code again . So what is the best way to find errors in your codes?

I know of no easy way to find errors due to typo but at least yours was syntax or invalid function which will be reported by PHP. If the errors were in the variables it could be a painful process in locating them.

If members know of one I would love to hear it.

Well, the general method I use is the pseudo-breakpoint method.
Stick echos into the code at various/key points on your development server, echoing out the variable you think is incorrect. When you hit a value you wernt expecting, you’ve narrowed down which lines of code to look at.