Jump to content

payney

Members
  • Posts

    48
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

payney's Achievements

Member

Member (2/5)

0

Reputation

  1. Hi guys, I cant figure out how to do the following. My query returns 10 rows, and I want the layout to do the following. Each row as 2 columns and then they are listed under one another. Just like the products are here: http://www.yorkfitness.com/Treadmills-cat-501/Index.html This is my code: <?php if (!($connection = @ mysql_pconnect($hostname,$username, $password))) showerror(); if (!mysql_select_db($databaseName, $connection)) showerror(); $query = "SELECT n.name As News_Name FROM NEWS n"; if (!($result = @ mysql_query ($query, $connection))) showerror(); // execute query $result = mysql_query($query) or die ("Error in query: $query. ".mysql_error()); if (mysql_num_rows($result) > 0) { } else { echo "No information for the home page set!"; } while ($row = mysql_fetch_assoc($result)) { ?> <? echo $row['News_Name']; ?> <? } mysql_free_result($result); // close connection mysql_close($connection); ?>
  2. No probs BTW, do I do the same for images? Would it be like this: if ($extention != 'jpg'||'gif') { echo "invalid file type"; $ok=0; } BTW, this dosnt work haha
  3. Adam. There was no result from that echo, which kinda solved my problem. I needed: $file_type= basename.($_FILES['uploaded']['name']); Instead of: $file_type= $_FILES["file"]["name"]; dooper: The Hosting provide php on their server.
  4. Still saying incorrect file type. This is what i am uploading C:\Documents and Settings\Sam\My Documents\green_styles.css
  5. Anyone? Sorry for been inpatient, I need to hand this work in about 2 hours
  6. Neither solutions work. Both state incorrect file type, whatever I try an upload.
  7. Hi guys, all I want to do is make sure that the uploaded file is a CSS file extention, I cant seem to do it. This is my code: <?php $target = "photo/"; $target = $target . basename( $_FILES['uploaded']['name']) ; $ok=1; $stylesheet = $stylesheet . basename( $_FILES['uploaded']['name']); $uploaded_type = $_FILES['uploaded']['type']); $name = $_POST['name']; //This is our size condition if ($uploaded_size > 100000) { echo "Your file is too large.<br>"; $ok=0; } //This is our limit file type condition if ($uploaded_type != "css") { echo "No CSS files<br>"; $ok=0; } //Here we check that $ok was not set to 0 by an error if ($ok==0) { Echo "Sorry your file was not uploaded"; exit; } //If everything is ok we try to upload it else { if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)) { echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded"; } else { echo "Sorry, there was a problem uploading your file."; $ok = 0; exit; } } if ($ok == 1) { //then do the inserting etc..... Please help guys S
  8. Hi guys, could someone tell me how to convert this date format which is stored as an int(11) into this format: $row['post_time'] is displayed as 1192193673 How can I convert it to this format: 17 Oct 2007 08:34 pm Cheers guys
  9. Bugger! Was missing 2 of them, cheers matey
  10. Hi guys, I have not got a clue why this is not working. Please help Basically, all I want to do is display the output in some rows. This is the code: if (mysql_num_rows($result) > 0) { echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>"; while($row = mysql_fetch_array($result)) echo "a"; echo "<tr>"; echo "<td width='47' height='35' align='center' valign='middle' class='forum_bottom'><div align='center'><img src='forum/templates/subSilver/images/folder_big.gif' width='46' height='25' align='absmiddle' /></div></td>"; echo "<td width='1106' valign='top' class='forum_bottom'>".$row['topic_title']."</td>"; echo "</tr>"; } echo "</table>"; Just to confirm, echo "a" is echoing the correct amount of times, Only ONE row is being displayed, in this one row is just the image. Thats it. You can see the result here: http://www.methleyroyals.co.uk/university/f_temp2.php
  11. Hi all. I am wanting to query my DB and simply put the results into an XML format. I thought it would be pretty easy but I keep getting problems. Can anyone let me know whats wrong <?php require ('db.php'); if (!($connection = @ mysql_connect($hostname,$username,$password))) die("Could not connect to database"); if (!mysql_select_db($databaseName)) echo "DB ERROR"; $query = mysql_query("select image, caption from image_link"); while ($row = mysql_fetch_array ($query)) { $image = $row['image']; $caption = $row['caption']; $items_output .= <<<EOF <pic> <title>{$image}</title> <caption>{$caption}</caption> </pic> EOF; } ?> <?xml version="1.0" encoding="utf-8" standalone="yes"?> <? echo "<images>".items_output."</images>"; ?>
  12. That is correct, just realised that when returning the query. Whoopsy daisy. Problem solved by changing the name of username to username2. Cheers for all the help and effort guys
  13. I get no records returned. this does not make sense to me. If I hard code the id, username or password it works, but if i assign the variable before the query like: $username = 'payney'; This dosnt work neither.
×
×
  • 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.