premiso
Members-
Posts
6,951 -
Joined
-
Last visited
-
Days Won
2
Everything posted by premiso
-
[SOLVED] Do you see anything wrong with this piece of code?
premiso replied to SocomNegotiator's topic in PHP Coding Help
I am not saying it will cause problems, you can, by all means do it. Whether it is required or needed, no not really. And doing it without really fully understanding why could cause someone problems. As for me, I prefer to leave int's outside of quotes, so incase my form does screw up I get an error message about it. But that is just me being particular. -
$filename = (substr_count(".html",$basename) > 0 ) ? substr_replace($basename,"",-1) : $vbasename; Try that, you had a $ in there when you did not need one and a ; after the substr_replace statement, which is not needed. I assumed vbasename needed the $ so I added it there.
-
[SOLVED] Do you see anything wrong with this piece of code?
premiso replied to SocomNegotiator's topic in PHP Coding Help
Not exactly true, numerical data, as PF pointed out, will be just fine. Yes, string values need to be surrounded with single quotes, or it is just in-proper syntax, and throws a syntax error. But from the error, it seems as though a value should be there, that is not. Which is due to poor validation techniques. As far as MySQL thinking it is a command, may be, but not all data needs 'single-quotes' around it -
Or you can define the border attribute inside the <img tag. print "<a href= 'reply.php' ><img border='0' src='images/reply-btn.gif' width='100' height='32'></a>"; Or try changing border of 0 to be: img{ border:none; } And see what that produces, this will effect every image on your site, however.
-
[SOLVED] Do you see anything wrong with this piece of code?
premiso replied to SocomNegotiator's topic in PHP Coding Help
Then why code in it if you hate it? -
$result = mysql_query("DESC table_name") or die("Table tablename does not exist"); Would be one way. If mysql_error is called, it will return: Upon an invalid tablename.
-
isset($_POST['key']) No, it is better to include your class files separately, at least in my opinion, then you can have the class_lib.php have a function like "callClass($classname)" so you include the file only when needed, or just have it include all the classes (not sure if one is better than the other, but yea). In my line of thinking, only call the classes when they will be used, should save processing time. Again I am not sure if it will, that is just my view on it.
-
I think what PF was getting at was that, maybe they have a bot that can post to multiple forums at once? Instead of having to manually go and post! Highly unlikely that they could get a bot to do that for them, but it could be Which they would reply the ones that get a response.
-
As sdi said, it is not like .NET However, there are some "debuggers" that check syntax etc before you run a script: http://www.zend.com/en/community/pdt Eclipse with the PHP Plugin is a great debugger, it does show you possible errors etc.
-
lol, now that would have been classic. But I agree, thanks for disabling it, as it is annoying. Although, it could be a sort of filtering system, if they have a poll that is gibberish, they must be a bot, and thus we do not need to reply! Could be a spam filtering system...except spammers know better than to make a poll...
-
If ken's answer is not what you are looking for, you can look into serialize and unserialize, but re-reading the question, I think ken hit the nail on the header.
-
Google PHP mod_rewrite
-
You can use an IFRAME or look into AJAX.
-
If you can, you probably have to use an ActiveX control to do it. Which the user has to allow to be installed. I am not sure, cause I have never been able to do it, nor have I really looked. But with an activex control allowed by the user I am sure it is possible.
-
SELECT id FROM mytable WHERE DATE_FORMAT('%Y-%c', id_date)='$dmonth' Should get you the results you want. MySQL DATE_FORMAT
-
How Can I Count Pageviews and Display on Another Page?
premiso replied to fender967's topic in PHP Coding Help
header would be a good redirect. As far as why are you adding cat to that, it is not needed, unless a link is going to be under multiple categories. -
How Can I Count Pageviews and Display on Another Page?
premiso replied to fender967's topic in PHP Coding Help
You will either need to use files (not recommend) or a MySQL database (recommended). For files look into: fopen, fwrite and fclose. The script you create will be something like "linkout.php" then the links on the page would be "linkout.php?id=4" etc. -
You need to read up on MySQL and proper usage. This is all basic basic SQL. Note the bold area.
-
<?php while ($row = mysql_fetch_assoc($result)) { if ($last_cat != $row['category']) { echo "<br />" . $row['category'] . "<br />--<br />"; $last_cat = $row['category']; } echo $row['friend'] . "<br />"; } ?>
-
Everything can be divided as long as it is not trying to be divided by 0. You mean to say, is the passed in number divisible by 2? <?php function lygu ($a) { if (($a % 2) == 0) { // parans here around the first portion echo "Number is divisible by two."; } else { echo "Number is not divisible by two."; } } $a = $_POST['a']; lygu ($a); ?>
-
SELECT category, friend, friend2, friend_text, friend2_text FROM friends GROUP BY category That should do it. Instead of a group by, however, you could just use ORDER BY category, and that should work.
-
$query = mysql_query("SELECT * FROM `news` WHERE `ID` <> 0 ORDER BY `ID` DESC");
-
[SOLVED] Deleting a variable from an array...
premiso replied to Montiero's topic in PHP Coding Help
unset if you know the index of the variable. <?php foreach ($array as $index => $val) { unset($array[$index]); } ?> Should do the trick. -
Ok, which line are you talking about? The domain lines? If the domains have an extra space in them, this should fix that: foreach ($arrayofdomains as $domain) { $arrayofdomainentries[] = array( // first element 'domain' => trim($domain), 'category' => array('x'), 'forsale' => x, 'price' => 'xxx.00', 'minprice' => 'xxx.00', 'fixedprice' => x, 'currency' => x, 'domainlanguage' => 'en' ); } I guess I am confused about what is not working.
-
Update your Zend Engine API version?