Jump to content

erron

New Members
  • Posts

    9
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

erron's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. i have this bit of code which is supposed to do a while loop of rows from a database then inside that does a while loop of columns, so its basically creating a html table of dynamic data from mysql. the column loop works fine, but the row one isnt, it only goes through and echos out the first row then stops. ive spent hours now trying to see why and i cant see it hence my call for help. $totalrows = 4; $columns = 5; $columncount = 1; $rowcount = 1; echo "<table>"; while ($rowcount <= $totalrows) { echo "<tr>"; $sql = "SELECT * FROM ville_map WHERE id = '$rowcount'"; $sql_result = mysql_query($sql, $connection); while ($row = mysql_fetch_array($sql_result)) { $c1 = explode(',', $row["c1"]); $c2 = explode(',', $row["c2"]); $c3 = explode(',', $row["c3"]); $c4 = explode(',', $row["c4"]); $c5 = explode(',', $row["c5"]); while ($columncount <= $columns) { $arraynum = ${'c'.$columncount}; if ($arraynum[2] > 0) { $playerimage = '<img src="images/player' .$arraynum[2]. '.png"'; } else { $playerimage = ""; } echo '<td background="images/' .$arraynum[0]. '.jpg" width="50" height="50">' .$playerimage. '</td>' ; $columncount++; } } echo "</tr>"; $rowcount++; } ?> </table> any help would be much appreciated.
  2. thanks, already did something similar to check file was found correctly and it was, i have now fixed the problem by giving the chmod a path from the script location: chmod("../productpics/$fileonly",0644); no idea why it has suddently required this after all this time but its now working.
  3. i should add also that when running the upload page i get the following error: "Warning: chmod() [function.chmod]: No such file or directory in /home/fieldsol/public_html/admin/addproduct_process.php on line 25" line 25 is the chmod funtion.
  4. hi guys hoping someone can help as my host is being no help at all. i have the following script which has been working for a few months now, suddenly it has started chmod'ing the directory 'productpics' instead of the file that is being uploaded. the file does exists and error checking finds that $fileonly is getting the correct name of the file but the script chmod's the directory to 644 and ignore the file. could this relate to a recent php upgrade by my host and a change of how it works? $uploaddir = '../productpics/'; $uploadfile = $uploaddir . basename($_FILES['file']['name']); $fileonly_t = $_FILES['file']['name']; $fileonly = urldecode("$fileonly_t"); if (move_uploaded_file($_FILES['file']['tmp_name'], $uploadfile)) { chmod($fileonly, 0644); } any help would be much appreciated.
  5. Thanks guys, tried that and a few other work arounds and settled with using str_replace and php_self
  6. hi, can someone help me, i know how to get a site url and how to get part of a string, but what im finding difficult is getting the end of a url, for example: http://www.mysite.com/mypage/index.php from this, how would i get 'mypage' as a string?
  7. Thankyou for that, after a lot experimenting and questions, the following works a charm: $fix = "alter table `".$username."_core_acl_aro` change `aro_id` `aro_id` int (11) NOT NULL AUTO_INCREMENT , add primary key (`aro_id`)"; mysql_query($fix); Thanks again.
  8. hi, no matter how much i google search this, i cant find the answer. how do i set the primary key and auto_increment on an already existing field in a table. For the history, im copying 35 tables in a database with different table names using: $table = "CREATE TABLE IF NOT EXISTS ".$username."_banner SELECT * FROM default_banner"; mysql_query($table); but this does not copy over the primary key and auto_increment settings.
×
×
  • 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.