Jump to content

MadTechie

Staff Alumni
  • Posts

    9,409
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by MadTechie

  1. quick simple example <?php $handle = fopen("test.csv", "r"); echo "<?xml version=\"1.0\" ? >"; //remove space after ? (added for make it format in here) echo "<rss version=\"2.0\">"; echo " <channel>"; echo " <title>test</title>"; echo " <link>http://www.test.com/</link>"; echo " <description>test</description>"; $row = 1; while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) { for ($c=0; $c < $num; $c++) { $title = $data[0]; $link = $data[1]; $description= $data[2]; echo " <item>"; echo " <title>$title</title>"; echo " <link>$link</link> "; echo " <description>$description</description>"; echo " </item>"; } } fclose($handle); echo " </channel>"; echo "</rss>"; ?>
  2. i'm not sure what your asking..
  3. you could just build hidden form elements ie ie <?php foreach($_POST['orderid'] as $item => $quantity) { $quantity = $_POST['quantity'][$item]; if($quantity>0) { print "Item# ".$item." : Quantity ".$quantity."<br />"; print "<input type=\"hidden\" name=\"$item\" value=\"$quantity\">"; } } ?> but personally i would use session remember use the session_start(); at the start!
  4. if you can supplie the images you have used i'll have a play, see what i can do (but i don't have much free time)
  5. Okay i got dinner will be back quick update <fieldset style="padding: 2"> <legend>Available Colours</legend> <?php //Establish a connection to the Database $conn = mysql_connect('mysql2.freehostia.com:3306','adacom_CLine','clothingline'); //Select the MySQL database $db = mysql_select_db('adacom_CLine', $conn); $string = $_POST['ClothingCode']; //Issue SQL SELECT Statement $sql = "SELECT Colours FROM Colours ORDER BY Colours"; //Execute the SQL Statement and create a recordset $rs = mysql_query($sql, $conn) or die(mysql_error()); $NumberOfColours = mysql_num_rows($rs); echo "<table border=\"1\" id=\"Colours\" cellpadding=\"3\">\n"; $odd = true; $counter = 17; $c = $counter; //Loop through the recordset and display the necessary records while($row = mysql_fetch_array($rs)) { $Colour = $row['Colour']; if($c == $counter) echo "<tr>\n"; if($odd) { echo " <td width=\"25\">"; echo " <img border=\"0\" src=\"../images/colours/$Colour.gif\" width=\"25\" height=\"25\" alt=\"$Colour\">\n"; echo " </td>"; }else{ echo " <td width=\"25\">\n"; echo " <input type=\"checkbox\" name=\"$Colour\" value=\"ON\">\n"; echo " </td>"; } if($c == 0) { echo "</tr>"; $c = $counter; }else{ $c--; } $odd = !$odd; } if($c != 0) echo "</tr>"; mysql_close($conn); ?> </table> </fieldset> but now i know what your looking for i know what do to (will a rework)
  6. for it to work yes. simple reason is function's can't be used outside of a construct
  7. is this needed ? echo "<tr>\n"; echo "<td width=\"100%\"></td>\n"; echo "</tr>\n"; if not remove it
  8. the that line into a Constructor
  9. can you post the code you have
  10. your not using the code i pasted.. but i see what your doing <fieldset style="padding: 2"> <legend>Available Colours</legend> <?php //Establish a connection to the Database $conn = mysql_connect('mysql2.freehostia.com:3306','adacom_CLine','clothingline'); //Select the MySQL database $db = mysql_select_db('adacom_CLine', $conn); $string = $_POST['ClothingCode']; //Issue SQL SELECT Statement $sql = "SELECT Colours FROM Colours ORDER BY Colours"; //Execute the SQL Statement and create a recordset $rs = mysql_query($sql, $conn) or die(mysql_error()); $NumberOfColours = mysql_num_rows($rs); echo "<table border=\"1\" id=\"Colours\" cellpadding=\"3\">\n"; $odd = true; $counter = 17; $c = 0; //Loop through the recordset and display the necessary records while($row = mysql_fetch_array($rs)) { $Colour = $row['Colour']; if($c == 0) echo "<tr>\n"; if($odd) { echo " <td width=\"25\">"; echo " <img border=\"0\" src=\"../images/colours/$Colour.gif\" width=\"25\" height=\"25\" alt=\"$Colour\">\n"; echo " </td>"; }else{ echo " <td width=\"25\">\n"; echo " <input type=\"checkbox\" name=\"$Colour\" value=\"ON\">\n"; echo " </td>"; } if($c == 0) { echo "</tr>"; $c = $counter; }else{ $c--; } echo "<tr>\n"; echo "<td width=\"100%\"></td>\n"; echo "</tr>\n"; $odd = !$odd; } mysql_close($conn); ?> </table> </fieldset>
  11. can you post a example then.. or atleast an error
  12. okay try this <fieldset style="padding: 2"> <legend>Available Colours</legend> <?php //Establish a connection to the Database $conn = mysql_connect('mysql2.freehostia.com:3306','adacom_CLine','clothingline'); //Select the MySQL database $db = mysql_select_db('adacom_CLine', $conn); $string = $_POST['ClothingCode']; //Issue SQL SELECT Statement $sql = "SELECT Colours FROM Colours ORDER BY Colours"; //Execute the SQL Statement and create a recordset $rs = mysql_query($sql, $conn) or die(mysql_error()); $NumberOfColours = mysql_num_rows($rs); echo "<table border=\"1\" id=\"Colours\" cellpadding=\"3\">\n"; $odd = true; //Loop through the recordset and display the necessary records while($row = mysql_fetch_array($rs)) { $Colour = $row['Colour']; if($odd) { echo "<tr>\n"; echo " <td width=\"25\">"; echo " <img border=\"0\" src=\"../images/colours/$Colour.gif\" width=\"25\" height=\"25\" alt=\"$Colour\">\n"; echo " </td>"; echo "</tr>"; }else{ echo "<tr>"; echo " <td width=\"25\">\n"; echo " <input type=\"checkbox\" name=\"$Colour\" value=\"ON\">\n"; echo " </td>"; echo "</tr>"; } echo "<tr>\n"; echo "<td width=\"100%\"></td>\n"; echo "</tr>\n"; $odd = !$odd; } mysql_close($conn); ?> </table> </fieldset>
  13. Erm.. not really! your using it to loop once!... but you also have some inf. loops (if they loop) also <?php echo'$Colour'?> will not work should be <?php echo $Colour; ?> are you trying to build a table from the database records ?
  14. you lost me.. so i read the code now i am even more confused whats with the numberofcolours.. <?php $NumberOfColours = mysql_num_rows($rs); //....snip while(X <= $NumberOfColours) { $X = mysql_num_rows($rs) ?>
  15. Whats the error.. (should give to a BIG hint) something like "unexpected T_PRIVATE" or in other word using private outside of a class!
  16. not sure why your using an array from an image!? $dogeyesar[] = imagefilltoborder($dogeyes, $eyes_x[$i], $eyes_y[$i], $border, $newcolour2); infact imagefilltoborder returns a boolean, so it should be imagefilltoborder($dogeyes, $eyes_x[$i], $eyes_y[$i], $border, $newcolour2); same for $dogdetailsar[]
  17. Okay i had a closer look and theirs a few problems try this a few bug fixes <html> <body> <?php require_once('./config.php'); $db = mysql_connect($dblocation, $dbname, $dbpw) or die (mysql_error ("Cannot Link")); mysql_select_db ($dbname, $db) or die (mysql_error ("Cannot Select DB")); $id = (int)$_GET['ID']; if (isset($_POST['submit'])) { // here if no ID then adding else we're if ($_POST['id'] > 0) { $id = (int)$_POST['id']; $artist_realname = $_POST['artist_realname']; $artist_birthday = $_POST['artist_birthday']; $artist_hometown = $_POST['artist_hometown']; $artist_soundclick = $_POST['artist_soundclick']; $artist_myspace = $_POST['artist_myspace']; $artist_email = $_POST['artist_email']; $artist_bio = $_POST['artist_bio']; $sql = "UPDATE artistinfo SET artist_realname='$artist_realname',artist_birthday='$artist_birthday',artist_hometown='$artist_hometown',artist_soundclick='$artist_soundclick',artist_myspace='$artist_myspace',artist_email='$artist_email',artist_bio='$artist_bio' WHERE user_id=$id"; }else{ $sql = "INSERT INTO artistinfo (artist_realname,artist_birthday,artist_hometown,artist_soundclick,artist_myspace,artist_email,artist_bio) VALUES ('$artist_realname','$artist_birthday','$artist_hometown','$artist_soundclickname','$artist_myspace','$artist_email','$artist_bio')"; } // run SQL against the DB $result = mysql_query($sql); echo "Record updated/edited!<p>"; } elseif ($_GET['delete']) { // delete a record $sql = "DELETE FROM artistinfo WHERE user_id=$id"; $result = mysql_query($sql); echo "$sql Record deleted!<p>"; } else { // this part happens if we don't press submit if ($id == 0) { // print the list if there is not editing $result = mysql_query("SELECT * FROM artistinfo",$db); while ($myrow = mysql_fetch_array($result)) { printf("<a href=\"%s?id=%s\">%s %s</a> \n", $PHP_SELF, $myrow["user_id"], $myrow["artist_realname"], $myrow["artist_hometown"]); printf("<a href=\"%s?id=%s&delete=yes\">(DELETE)</a><br>", $PHP_SELF, $myrow["user_id"]); } } ?> <P> <a href="<?php echo $PHP_SELF?>">ADD A RECORD</a> <form method="post" action="<?php echo $PHP_SELF?>"> <p> <?php if ($id > 0) { // editing so select a record $sql = "SELECT * FROM artistinfo WHERE user_id=$id"; $result = mysql_query($sql); $myrow = mysql_fetch_array($result); $id = $myrow["user_id"]; $artist_realname = $myrow["artist_realname"]; $artist_birthday = $myrow["artist_birthday"]; $artist_hometown = $myrow["artist_hometown"]; $artist_soundclick = $myrow["artist_soundclick"]; $artist_myspace = $myrow["artist_myspace"]; $artist_email = $myrow["artist_email"]; $artist_bio = $myrow["artist_bio"]; // print the id for editing ?> <input type=hidden name="id" value="<?php echo $id ?>"> <?php } ?> Real Name: <input type="Text" name="first" value="<?php echo $artist_realname ?>"> <br> Birthday: <input type="Text" name="last" value="<?php echo $artist_birthday ?>"> <br> Hometown: <input type="Text" name="address" value="<?php echo $artist_hometown ?>"> <br> Soundclick: <input type="Text" name="position" value="<?php echo $artist_soundclick ?>"> <br> Myspace: <input type="Text" name="position" value="<?php echo $artist_myspace ?>"> <br> Email: <input type="Text" name="position" value="<?php echo $artist_email ?>"> <br> Bio: <textarea name="position" rows="5"><?php echo $artist_bio ?></textarea> <br> <input type="Submit" name="submit" value="Update Information"> </p> </form> <?php } ?> </body> </html> **untested
  18. Need more info !! as a guess try changing $id = $_GET['id']; to $id = $_POST['id'];
  19. it was probably an out dated tutorial, or a bad one
  20. Well your form use POST.. in truth i assumed your ID was Via Get but it also looks like a POST but i don't know your site as well as you would..
  21. you have Register Globals Off (which is a good thing) but means a little more work.. you could add extract($_GET); extract($_POST); to the start.. or do it correctly (see snip below) <html> <body> <?php //************ you could add //extact($_GET); //extract($_POST); //commented out coz i dislike it require_once('./config.php'); $db = mysql_connect($dblocation, $dbname, $dbpw) or die (mysql_error ("Cannot Link")); mysql_select_db ($dbname, $db) or die (mysql_error ("Cannot Select DB")); if ($submit) { // here if no ID then adding else we're editing //************ $id isn't set.. so Set it $id = $_GET['id']; if ($id) { //************ $artist_realname isn't set $artist_realname = $_POST['artist_realname']; //************ $artist_birthdayisn't set $artist_birthday= $_POST['artist_birthday']; //************ ETC ETC $sql = "UPDATE artistinfo SET artist_realname='$artist_realname',artist_birthday='$artist_birthday',artist_hometown='$artist_hometown',artist_soundclick='$artist_soundclick',artist_myspace='$artist_myspace',artist_email='$artist_email',artist_bio='$artist_bio' WHERE user_id=$id"; } else { $sql = "INSERT INTO artistinfo (artist_realname,artist_birthday,artist_hometown,artist_soundclick,artist_myspace,artist_email,artist_bio) VALUES ('$artist_realname','$artist_birthday','$artist_hometown','$artist_soundclickname','$artist_myspace','$artist_email','$artist_bio')"; } ?> Used ************ to highlight my comments EDIT: i mean extract not extact LOL
  22. Ok use Break (i'm still confused what your trying to do) Continue SKIPS the rest of the iteration which is what i think your trying to do!
  23. if you wish to skip it, do if($field == 1) {continue;} or i suspect this if($field == "1") {continue;}
  24. I'm a little confused, whats if($field == 1) {pass;} meant to do ?
  25. its not Mail format but Content-type.. the standard HTML page Content-type is text/html, for more info read up on MIME http://en.wikipedia.org/wiki/MIME, UTF-8 = Unicode (your see that used alot as well) *Edit: Typo
×
×
  • 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.