Jump to content

canty

New Members
  • Posts

    9
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

canty's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Yeah its just showed a blank page. I meant to write back to say that I have somewhat solved the problem... yet at the same time I have not! Basically I have a system where my client can upload songs and rename them etc, this is all stored in an SQL database. When a user comes to listen to the songs on the website itself the player requires an XML file for the playlist which needed to be auto updated each time my client made changes. Option 1 : Each user makes a new playlist.xml file when they visit the page - This caused problems with strings containing <? Option 2 : Rewrite the XML file each time client makes a change - This now works. But the code is actually no different to that in Option 1. My problems are solved, thanks very much for help. If anyone would like more info on a similar problem please don't hesitate to ask, I hope to help.
  2. short_open_tag = 0 like this? Still not working.
  3. Hi guys, thanks all for your help the solution was to put the count at the top straight after the query. I've got something else though, I have been building a site for a musician friend and they have hosting and domain with 34sp.com .... I've been having problems all the way through mostly due to permissions which I've never had with netoxide.co.uk. Latest problem is this <?php $newPlaylist = "<?xml version='1.0' encoding='UTF-8'?><xml>"; echo $newPlaylist; ?> I have this running its own file called "string.php" and it does not run - $newPlaylist ="xml"; does work however. Never had a problem like this before, and I certainly remember it working when I first wrote it. What is going on?
  4. Thanks will look in morning and let you know how I get on.
  5. Result: resource(3) of type (mysql result) Count: 9 This looks promising but its getting late... The count is now right!
  6. I've edited the original for a bit more clarity, should this be an issue when the page is only about 30 lines or so. The code is efficient I hope. Besides I'm doing another mysql_query specifically for this bit. Would putting it at the top of the code help?
  7. First off I know this will be a problem with my code but I honestly have looked at it for too long. If anyone can shed a bit of simple light on it that would be great. $count should return about 8 or 9 or so but just returns 1 - I can only print out the number 1 if I do a direct echo of the mysql_num_rows() instead of putting it into the $count variable. Its really confusing, the database is all set up correctly as earlier on in the page I get all the information from the database and print out a table with it. There is something wrong here! Problem only occurs when $count = mysql_num_rows($result1); is written. //Following user presses button with name applyChanges. if(isset($_POST['applyChanges'])) { $result1 = mysql_query("SELECT * FROM music") or die ("Could not get result1"); $count = mysql_num_rows($result1) or die ("Could not count rows"); //Changed this to an echo without $count and prints a 1. - Should be greater than 8 echo "$count"; for($i=0; $i<$count; $i++) { $query2 = "UPDATE music SET name='$name[$i]' WHERE path='$path[$i]'"; $result2 = mysql_query($query2); } } Thanks, Matt
  8. Right, its one of those. Came back to it and can't quite tell what happened. But now it works. Damned if I know! So the one I wanted to work now works. I think I just haven't been to sleep in a while.
  9. This is a pain. It seems totally logical to me and I had it working before I accidentally saved over the working version (major boo boo). This is two code snippets, first one is how I want it to work - One Query and the loop through results. Second does work, but then its going to have to run mysql 60 times, which could get slow as the site gets more use. $results = mysql_query($query); $response .= "<table><tr>"; if($nit == 0){ for($i = 0; $i < 60; $i++){ $dateCompare = date("Y-m-d", mktime(0,0,0,date("m"),date("d")+$i,date("Y"))); $dateForString = date("D d/m/Y", mktime(0,0,0,date("m"),date("d")+$i,date("Y"))); $response .= "<td height='350px' style='color:white; background-color:grey;'>$dateForString</td>"; while($row = mysql_fetch_array($results)){ $id = $row['id']; $poster = $row['poster']; $date = $row['date']; $response .= "$date : $dateCompare<br>"; if($date == $dateCompare){ $response .= "<td><a href='fullinfo.php?selected_id=$id'><img src='$poster' height='350px' /></a></td>"; } } } } FOLLOWED BY THE SECOND $response .= "<table><tr>"; if($nit == 0){ for($i = 0; $i < 60; $i++){ $dateCompare = date("Y-m-d", mktime(0,0,0,date("m"),date("d")+$i,date("Y"))); $dateForString = date("D d/m/Y", mktime(0,0,0,date("m"),date("d")+$i,date("Y"))); $response .= "<td height='350px' style='color:white; background-color:grey;'>$dateForString</td>"; $results = mysql_query($query); while($row = mysql_fetch_array($results)){ $id = $row['id']; $poster = $row['poster']; $date = $row['date']; if($date == $dateCompare){ $response .= "<td><a href='fullinfo.php?selected_id=$id'><img src='$poster' height='350px' /></a></td>"; } } } } First one results in -it seems - to only go through the while loop once, the first time. So out put is todays date, for the number of results from the database. The second works fine, prints out in order and matches up. I just don't like its inefficiency. Thanks Canty
×
×
  • 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.