Jump to content

rtsanderson

New Members
  • Posts

    7
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

rtsanderson's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I found the problem. There was a line of code that checked to see if there were any records. Since no record met the criteria, the code broke. I removed the line and everything is working now. Thanks everyone for the help.
  2. I managed to get it working with the query $sql = "SELECT * FROM shows"; But it won't work with this one. The page won't load at all. It used to work. Any ideas? $sql = "SELECT * FROM shows WHERE DateClose >= now() OR DateOpen >= now() ORDER BY DateOpen"; I'll definitely look into PDO
  3. Thanks. My original code was all MySQLi but when that stopped working, I grabbed some code from an online tutorial which was apparently out of date. I was originally using this method but I know that mysqli_result was deprecated and had added a function to permit the use of it. That worked for years. My suspicion is that the function no longer works. $i=0; while ($i < $num) { $Title=mysqli_result($result,$i,"Title,"); $i++; } This is the function: function mysqli_result($res,$row=0,$col=0){ $numrows = mysqli_num_rows($res); if ($numrows && $row <= ($numrows-1) && $row >=0){ mysqli_data_seek($res,$row); $resrow = (is_numeric($col)) ? mysqli_fetch_row($res) : mysqli_fetch_assoc($res); if (isset($resrow[$col])){ return $resrow[$col]; } } return false;
  4. Recently, the code stopped working on one of my sites. I made several attempts to fix it but couldn't find anything wrong. I checked two more sites that used similar code and they had stopped working as well so I assume that something changed in PHP. I've spent several hours trying to find the problem but haven't succeeded. I receive confirmation that I am connecting to my database but the code does not return any records. Any help would be greatly appreciated. <?php $servername = "mysql.woodjoint.com"; $username = "MyUsername"; $password = "MyPassword"; $db = "woodjoint"; $conn = mysqli_connect($servername, $username, $password,$db); if (!$conn) {die("connection failed: " . mysqli_connect_error()); } echo "<p>connection successful</p>"; /* THIS WORKS */ $sql = 'SELECT * FROM shows'; mysql_select_db('woodjoint'); $retval = mysql_query( $sql, $conn ); if(! $retval ) { die('Could not get data: ' . mysql_error()); } while($row = mysql_fetch_array($retval, MYSQL_ASSOC)) { echo "Title :{$row['Title']} <br> ". "Venue : {$row['Venue']} <br> ". "Address : {$row['Address']} <br> ". "--------------------------------<br>"; } echo "Fetched data successfully\n"; mysql_close($conn); ?>
  5. I am using the following script to list all of the files in a folder. The script is running on our server but I need the listing of data on a drive connected to another computer on the network. It works fine on the local drive on the server but it does not work when I try to access a mapped drive or another computer. Can this be done with the script I'm using? <?php $dirname = "c:"; $dir = opendir($dirname); while(false != ($file = readdir($dir))) { if(($file != ".") and ($file != "..")) { echo("$file <br />"); } } ?>
  6. Sorry. That was my first post here. I won't bother you again.
  7. I have a PHP webpage which interacts with a MySQL database. I would like to add a function to the page that sends an SQL statement to the database when a button on the page is pushed. The SQL will be embedded in the web page. How do I accomplish this?
×
×
  • 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.