
per1os
New Members-
Posts
3,095 -
Joined
-
Last visited
Everything posted by per1os
-
Is display_Errors set to on via www.php.net/ini_set and error_reporting(E_ALL) It sounds like you have an error in your code. Try doing a print_r($_POST); at the top.
-
$_POST should be capitol and the value is what would be printed out. It should print "0" ...really no matter what as long as they aren't a guest or an admin.
-
www.php.net/gpc_get_magic_quotes Check, if that is true stripslashes then escape. If it is not true just escape.
-
[SOLVED] Help with deleting from database, "SQL sytax error"
per1os replied to L's topic in PHP Coding Help
Nope as long as you didn't want any html in it. Depends on the field. I don't use strip_tags, I usually just convert the < and > to their html characters cause A lot of times I want to display code in my posts. It all depends on what is needed/required =) -
[SOLVED] Help with deleting from database, "SQL sytax error"
per1os replied to L's topic in PHP Coding Help
A little overkill. How is that over kill? Edit: Okay mabye the mysql_real_escape_string is a little much... Strip_tags is unnecessary because really we do not care if they are in there, once it is converted to an integer either way it does not matter. The trim is fine, but still unnecessary as stated above, once it is converted to an int it does not matter, all that text just magically disappears. The bigger question is, if he is expecting an INT he should check to see if the string www.php.net/is_numeric If it is not numeric obviously there is foul play and he should not even try to check it against the database. <?php if (isset($_GET['del']) && is_numeric($_GET['del'])) { $com = intval($_GET['del']); // for good measure }else { $com = null; } if (!is_null($com)) { // do query here. } $id = isset($_GET['id'])?intval($_GET['id']):null; if (!is_null($id)) { // do select statement here } ?> You are just using unnecessary processing time with trim, mysql_real and strip_tags. -
<?php echo '<script type="text/javascript">window.location = history.go(-1);</script>'; ?> Unsure if my Javascript is correct but that should do it.
-
[SOLVED] Help with deleting from database, "SQL sytax error"
per1os replied to L's topic in PHP Coding Help
A little overkill. <?php $com = isset($_GET['del'])?intval($_GET['del']):null; // convert the get data to int, this would prevent any foul data coming in if (!is_null($com)) { // do query here. } $id = isset($_GET['id'])?intval($_GET['id']):null; if (!is_null($id)) { // do select statement here } ?> The issue you are having with the id is that no matter what you are running that query, even if no GET data was added on. Add that into your code and you should be fine. -
[SOLVED] Parsing Assistance Needed With XML Files
per1os replied to mykel241's topic in PHP Coding Help
<?php $xml_file = file_get_contents('xmlfile.xml'); while (true) { if (ereg("<root contentId=\"([0-9]*)\">", $xml_file, $matches)) { $ids[] = $matches[1]; // I think thats right $xml_file = str_replace("<root contentId=\"" . $matches[1] . "\">", "", $xml_file); }else { break; } } print_r($ids); ?> Unsure if that will work, but yea. I thought there was a way that it would return all the results. But hopefully the above works and runs somewhat fast. -
[SOLVED] Help with deleting from database, "SQL sytax error"
per1os replied to L's topic in PHP Coding Help
Where is the code after $_GET['id']; ??? We need to see the whole picture bud. (Up to I meant literally go up from that point...) -
[SOLVED] Help with deleting from database, "SQL sytax error"
per1os replied to L's topic in PHP Coding Help
Which means that $id does indeed not have a value. Make sure case is correct and something wouldn't be overriding it. Because I bet if you did this it would work: $news = mysql_fetch_array(mysql_query("SELECT * FROM `news` WHERE `id`= 1 ORDER BY `id`")) or die(mysql_error()); IE: Post more code so we can see what might be the cause. (Like upto where you define $id) -
[SOLVED] Help with deleting from database, "SQL sytax error"
per1os replied to L's topic in PHP Coding Help
$id must not have a value. The error is stating that `id`= after the = there is nothing there to check against it. Which is throwing the error off. If you want to see it clearer add this: $news = mysql_fetch_array(mysql_query("SELECT * FROM `news` WHERE `id`=$id ORDER BY `id`")) or die(mysql_error()); You will notice the portion of where the order by is. -
$query = "SELECT * FROM sports s, categories c, sport_catog sc WHERE s.SportId = sc.SportId AND c.CategId = sc.CategId AND c.CategId = ".$_GET['catog'] . " ORDER By s.SportTitle ASC"; Also be wary of SQL Injection with including the $_GET directly into the sql like that.
-
Your barking up the wrong tree, this isn't a PHP problem, this is Javascript/HTML I suggest posting there.
-
[SOLVED] Help with deleting from database, "SQL sytax error"
per1os replied to L's topic in PHP Coding Help
<?php $com = isset($_GET['del'])?$_GET['del']:NULL; ?> If del has a value set it to that value else set it to null. Check for www.php.net/is_null And your statement is true, it is suppose to be empty until the form is submitted. So you do NOT want to run the query if $_GET['del'] has NOT been set. -
Alright here are just some basic checks. Make sure the file is not being manipulated after uploaded to the server (view the file on the server and check for any type of space, enter gap whatever before the first <?php statement) If there is it is a problem with how your ftp program uploads the file, what FTP program are you using? Also check the type of file you are working with in Notepad++ Make sure it is not the UNIX one (I believe that one is known for this type of issue) Other than that I do not know what to have you try. The issue is definitely with the file on the server having an extra space at the top.
-
[SOLVED] Parsing Assistance Needed With XML Files
per1os replied to mykel241's topic in PHP Coding Help
<?php $xml_file = file_get_contents('xmlfile.xml'); $root_split = split("</root>", $xml_file); foreach ($root_split as $root) { if (eregi("\">", $root)) { list($ids[]) = split("\">", $root); } } print_r($ids); ?> Also here is my shot at a regex version <?php $xml_file = file_get_contents('xmlfile.xml'); ereg('<root contentId=\"([0-9]*)\">', $xml_file, $matches); print_r($matches); ?> I am not very good with Regex, but hopefully the above is correct and works. -
What editor are you using to modify the file?
-
www.php.net/chmod The file and the directory need to be able to be written to. 777, you should be able to do it manually with an FTP program.
-
[SOLVED] Help with deleting from database, "SQL sytax error"
per1os replied to L's topic in PHP Coding Help
make sure $com contains a value. check for www.php.net/empty On a side not, post the form code that this gets submitted from. Make sure it is GET you should be using and that del should contain the comment id and is not just a verification hidden field. -
$donnee['aprouve']=$_POST['aprouve']; if ($donnee['aprouve']=="1") echo "oui"; elseif ($donnee['aprouve']=="0") echo "non"; while($donnee = mysql_fetch_array($query)) { echo "<tr>"; echo "<td>" . $donnee['id_nouvelle'] . "</td>"; echo "<td>" . $donnee['titre'] . "</td>"; echo "<td>" . $donnee['text'] . "</td>"; echo "<td>" . $donnee['description'] . "</td>"; echo "<td>" . $donnee['aprouve'] . "</td>"; echo "<td>" . $donnee['date_affichage'] . "</td>"; echo "<td>"; } I think thats what you were trying to get at.
-
Are you sure that data is pulling correctly from the remote site. Do a vardump on $record.
-
Thanks, this is line 1 on details.php: <? include("check.php"); ?> Try <?php include("check.php"); ?> Also, if you are using dreamweaver, sometimes they do weird stuff. Copy the code for details.php and paste it in notepad, make sure that the <?php is at the VERY top, in both details and check.php either or will throw the error. Submit to the server and see if that fixes it.
-
If you search this forum you should find a few examples. I know in someone's signature there is a link to a page of how to do it. Forget his name but it can be found on these forums. http://snippets.tzfiles.com/snippet.php?id=10 May be a start for you.
-
Try specifying a salt for it.