
Asday
Members-
Posts
77 -
Joined
-
Last visited
Never
Everything posted by Asday
-
Incorrect syntax, and a side order of $_POST being weird
Asday replied to Asday's topic in MySQL Help
Because I'll be just pulling the raw text straight from the table, and echoing it, so if I want to output "03/11/91 - 2 (Hellsyeah, awesomeness.)" I can. -
Incorrect syntax, and a side order of $_POST being weird
Asday replied to Asday's topic in MySQL Help
(Sorry for the doublepost, the edit button's gone AWOL.) Ok, I got it to submit the data now, but it's still appearing as blobs in the database. I now have one BLOB - 8B as the date, and one BLOB - 6B as the content. What's going on, and how do I fix it? -
Incorrect syntax, and a side order of $_POST being weird
Asday replied to Asday's topic in MySQL Help
I set them to "text" and "longtext" under the pretence I'd be having multiple entries in a single day. I got rid of the two blank rows, and modified the PHP to your suggestions, same result, only no change in the table this time. -
Incorrect syntax, and a side order of $_POST being weird
Asday replied to Asday's topic in MySQL Help
That's fairly weird. Now I get "Query failed: " and nothing else. The table now has this in it. No idea what it means, though. -
Incorrect syntax, and a side order of $_POST being weird
Asday replied to Asday's topic in MySQL Help
I thought that $_POST[date] needed to be $_POST["date"], but things weren't working, so I changed it, and things stayed the same (and when asked to echo $_POST[date] after I'd set it, it echoed the right thing.) Anyway, now I'm left with a blank screen. It appears to be attempting to execute the second block of code. -
MySQL version: 5.0.51b-community-nt Error given: "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1" At the moment, I've been wrestling with this code for quite a while. I want it to show a simple form when $_POST isn't set (and for some reason, it's always set, so I've used $_POST[date]) and when it is set, write $_POST[date] and $_POST[content] to the relevant places in the sql table. For some reason, it's failing now, and I'm well and truly stuck. <?php $html = "<html><head></head><body><p><form action=\"newspost.php\" method=\"post\">Datemarker: <input type=\"text\" name=\"date\" />Content: <input type=\"text\" name=\"content\" /><input type=\"submit\" /></form></p></body></html>"; if($_POST[date] == "") { echo $html; } if(isset($_POST)) { echo $_POST[date]; $con = mysql_connect("localhost","user","pass"); mysql_select_db("sg194", $con); $date194 = $_POST[date]; $content194 = $_POST[content]; $query = "INSERT INTO frontpage_news (date,content) VALUES (".$date194.",".$content194.")"; mysql_query($sql, $con); mysql_close($con); } ?> Apologies if this is in the wrong section.
-
This code: <?php $j=0; function shade($mode) { if ($mode == 0) { echo '</tr><tr style="background-color:#DDDDDD">'; $j = 1; } else { echo '</tr><tr>'; $j = 0; } } $i=0; foreach(scandir("upld194") as $x) { if ($i == "2") { shade($j); //echo '</tr><tr>'; echo '<td><a href="upld194/' . $x . '">' . '<img src="upld194/' . $x . '">' . '</a></td>'; $i = 0; } else { echo '<td><a href="upld194/' . $x . '">' . '<img src="upld194/' . $x . '">' . '</a></td>'; $i++; } } ?> which is meant to shade every other row in grey, shades every row but the first grey. Why?
-
Haha, fixed it. Missed a ". Code fixed.
-
<table border="3" width="100%"> <tr> <td align="center"> <form action="gallery.php" method="post" enctype="multipart/form-data"> <input type="file" name="file" id="file" /> <input type="submit" name="submit" value="Post!" /> </td> </tr> <tr> <?php echo '<td align="center">Browse for a picture here, or alternatively, type in the URL, and click the appropriate button to upload the said picture.</td>'; ?> </tr> </table><br /> <table border="1" width="100%"> <tr> <?php $i=0; foreach(scandir("upld194") as $x) { if ($i == "2") { echo '</tr><tr>'; echo '<td><a href="upld194/' . $x . '>' . $x . '</a></td>'; $i = 0; } else { echo '<td><a href="upld194/' . $x . '>' . $x . '</a></td>'; $i++; } } ?> </tr> </table> On all but the last file link, it comes out with the wrong link, with a suffix of lots of percent signs, and other such nonsense. Any help would be appreciated.
-
That was the problem, thanks. It all werks now.
-
<?php // ... for($x=($piccies=(scandir("upld194")))) // line 22 // ... ?> Produces: Parse error: syntax error, unexpected ')', expecting ';' in C:\xampp\htdocs\new\index.php on line 22 And I can't, for the life of me, work out where to put the stuff. Halp, please.
-
[SOLVED] actually two things: ip address and adding style in php ?
Asday replied to jd2007's topic in PHP Coding Help
Why the dots? -
[SOLVED] actually two things: ip address and adding style in php ?
Asday replied to jd2007's topic in PHP Coding Help
Plech. Give me a moment. <span style="background-color:#CCCCCC;"> <?php echo "This is another paragraph"; ?> </span> -
You might just want to go into werd itself, and save it as an .htm. You can tidy up the html at a later date. Why's it urgent?
-
Blast! Thanks. With js, AJAX or CSS, how would I go about it? If someone could just post the code (or the trick I need to learn) I can probably take it from there.
-
[SOLVED] actually two things: ip address and adding style in php ?
Asday replied to jd2007's topic in PHP Coding Help
You will need to drop out of php and do a bit of html. Like so: <body bgcolor="#CCCCCC" text="#000000"> <?php echo "wtf? colour! (Of a sort...)"; ?> </body> -
How do I make a custom tooltip appear when someone hovers over a certain (blue underlined) word in an echo, then disappear after X amount of time?
-
How do I fix this message: Parse error: syntax error, unexpected $end in C:\xampp\htdocs\index.php on line 50 For this code: ... <br /><br /><form action="index.php" method="post"> Rand-: <input type="checkbox" name="rand-" checked="checked" /><br /> Date-: <input type="checkbox" name="date-" checked="checked" /><br /> For--: <input type="checkbox" name="for--" checked="checked" /><br /> Count: <input type="checkbox" name="count" checked="checked" /><br /> New--: <input type="checkbox" name="new--" checked="checked" /><br /> <input type="submit" value="Clicky!" /> </form> // line 50 (I know the code's probably wrong, I've been messing around with it, to try and fix the error, but I have no idea) Any help would be greatly appreciated. Thanks. EDIT: The code is an html block in a php script. line 50 is the end. EDIT: Haha, nevermind, I forgot to close an if statement up near the top of the script. Sorry.
-
Would that be Linux or windoze command prompt?
-
But the idea is to test them, and I can't remotely unzip them...
-
Something like if strpos($number(strlen($number) - 1)) == 0 { //code } else { //code } I think.
-
Ooh, would that work? *Checks* Nope: "Allowed file types: doc, gif, jpg, mpg, pdf, png, txt, zip"
-
Thanks! That worked (Had to fiddle with it to get it to work with my existing code) <?php if (($_FILES["file"]["type"] == "image/gif") // ... && ($_FILES["file"]["name"] !== (substr($_FILES["file"]["name"], strlen("http://"))))) { // upload } else { echo "Sod off."; } ?>
-
I've looked up substring on google, but I don't quite understand. Case: I want to disallow anything starting with "http://" I've got this far: if ($_FILES["file"]["name"] !== // something
-
Any ideas I can temporarily stick some PHP files to test them? Once I find out a place, I'll post the link. I want people to try uploading different files. (avis, mpgs, mp3s, bmps, jpgs, gifs, txts, htmls, xmls)