Hi guys,
I am struggling a bit with some code.
I have put the code on my own test hosting website yet it is not displaying anything... not even an error message.
Here is the code

<?php
    $conn = msqli_connect("xxxxx","xxxxxxx","xxxxxxx","xxxxxxxx")
            or die ("Could not connect to mysql because ".mysql_error());

            $q = "SELECT * FROM news WHERE newsstatus='Enabled'";
            $q = "ORDER BY newsdate DESC";
            $result = mysqli_query($conn,$q);

            {
                while ($row = mysqli_fetch_array($result))
                {
                    echo"
                    <div class='summary'>
                        <p><strong>" . $row['newstitle'] . "</strong</p>
                                   " . $row['newstitle'] . "
                        <p>" . $row['newssnippet'] . "</p>
                        <p>><img src='http://www.agile-cms.uk.com/news/" . $row['newsimage'] . "' alt='" . $row['newstitle'] . "' /></p>
                        <p><a href='newsitem?i=" . $row['newsid'] . "'>Read More</a></p>
                    </div>


                    ";
                }
            }


?>

Basically I have this php file and another file to display the results of this query using this:

<?php
include("functions/news_fns.php");
?>

When I run the debugger on PHPEdit it displays Fatal error: Call to undefined function msqli_connect() in C:\ On line 2, line 2 being the connection string. I know it isn't the connection string though because it the same connection string I have used in a different file (Which does as it is told) I have literally copied and pasted it.

Any thoughts on where I could be missing something?

Cheers!

Recommended Answers

All 3 Replies

Member Avatar for diafol

Typo:

msqli_connect

Should be

mysqli_connect

ALways check your spelling with these types of messages.

I would never have seen that, Thanks!
Unfortunately now it has thrown out a whole new error :(

Member Avatar for diafol

OK

CHange your connection details as they were here for everybody to see. I've edited your post. Do this NOW.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.