Zhadus
-
Posts
376 -
Joined
-
Last visited
Never
Posts posted by Zhadus
-
-
Sorry for the lengthy time to respond, a bit busy on my end.
If really have the process down from what I can see, you're just missing a component.
When you put a variable in the address bar, for instance you have a link that goes to:
page.php?var=blah
When it goes to that page, you don't automatically have the variable $var, it's $_GET['var'].
You understood this with:
$var = @$_GET['q'];
But then the variable $s is passed up, and you don't get it before you check if it's empty, you need:
$s = $_GET['s'];
-
You have this :
echo " <a href=\"$PHP_SELF?s=$news&q=$var\">Next 10 >></a>";
Which pass the variables 's' and 'q' to the new page.
On the page you GET the variable 'q' using this statement:
$var = @$_GET['q'] ;
But you don't have a similar statement for $s/$_GET['s'].
-
You pass the variable 's' through the address bar, but you never GET it on the new page like you do with the variable 'q'.
I'd also recommend using better variable names, it helps others know what a variable is for without looking at when it is initialized.
-
Do you mean when you click the link it does nothing or does it do something undesired. Like does it refresh the page, change pages but shows the same data etc.?
-
Google is your friend!
http://php.about.com/od/finishedphp1/ss/php_calendar.htm
Realistically though I looked through it and it's a pretty good basis, explains a few of the details in case you have other questions, otherwise I'd suggest just tackling it yourself and checking the manual for reference and us here for specific questions.
-
You grasp the concept, you're just not using the right functions.
As long as I am reading you correctly, you just need to check if a file is in place in the thumbs folder, and if it isn't, make the main image resized smaller to display. You can use this function: file_exists().
-
Forums do that, there's nothing wrong with the code.
-
Additionally, using asmith's code you can check the extension for valid filetypes:
<?php $file_ext = end(explode('.',$_FILES['uploadedfile']['name'])); if (($file_ext == 'jpeg') || ($file_ext == 'jpg') || ($file_ext == 'gif') || ($file_ext == 'png')) { // All is good } else { // Bad filetype } ?>
-
<?php include "config.php"; if($logged[id]){ echo '<div id="gameoptionsmenu"><form name="add" action="addfav.php" method="POST"> <input type="hidden" value="' . $name . '" name="fav"> <input type="hidden" value="' . $url . '" name="fav2"> <input type="submit" class="submit" value="+ Add To Favourites +"> </form>'; } ?>
That should do it for you. When you are within an echo statement, you merely need to break and input the variable, as opposed to echoing again.
Please use the starting and end [\code] tags in the future.
-
Thank you so much. I have some more learning to do I see.
-
Here is a function that you can use that will count the images in the directories:
<?php function countImages() { if ($handle = opendir("./")) // CHANGE TO TARGET DIRECTORY { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { $ext = explode(".", $file); if (($ext[1] == "jpg") || ($ext[1] == "jpeg")) { $files[] = $file; } } } closedir($handle); } $files = sizeof($files); return $files; } ?>
If you change to the correct directory (or run that function from within the directory you're searching) it will return the amount of files with extension .jpg or .jpeg.
Then on your display page you can use:
<?php $max = countImages(); $image = "<img src='gallery/$page/$page-"; for ($x = 0; $x < $max; $x++) { echo $image . $x . " />"; if (($x % 5) && ($x != 0)) echo '<br />'; } ?>
That will put 5 images on a line and then make a break. You should be able to manipulate it as needed from there.
-
Thanks for reading,
Anyway I need help with some regex, here is the pattern I have so far:
(\b[^\s]+\b\s*\()
Which will identify terms such as:
blah(
scien (
examp (
What I want it also to negate, are the terms:
if (
elseif (
Basically the term itself should not be if or elseif. I'm having trouble changing the [^\s] (No white space in the term) to also include no matching of the strings "if" and "elseif".
-
Can you post the code where $tradedate is coming from?
-
<?php if(isset($isloggedin)) {
Should be:
<?php if(isset($_COOKIE['isloggedin'])) {
-
That's odd, I actually tested that code.
print $tradedate to the screen before doing the strtotime() function and post exactly what it says.
-
MySQL doesn't understand it in that format, just need to reformat before inserting into the DB.
$date = "30-10-2009"; $date = date('Y-m-d', strtotime($date)); echo $date; // Output is 2009-10-30
-
That should work just fine.
Side Note: Please use the CODE tags when posting code.
-
You have it...
if (($word_count > 1) && (($col1 == "any") or ($col1 == "artist"))) { It all does } else { It doesn't }
-
if (strpos($libID, '10001') === 0) { good } else { redirect }
Checks to make sure 10001 occurs at the beginning of the string.
-
PHP and Databases. That's all a game like that is (aside from graphics). I'd recommend downloading a free one and take a look at how it's done, or start small using your own way to manipulate things. If you've done a lot of PHP before, it should fall into place pretty quickly.
-
Lots of PHP. With the form submission, you can have it insert values into a database, which you will draw for two purposes. You can draw from that database each time the calendar page is loaded up. Secondly, you can have a template page for the events that fills it's information by loading in the data from the database as well.
i.e.
User submits form for February 10th that saves in the database as 31 for the id. All users see there is an event on February 10th called "Test Event". The text will be a link to "template.php?id=31". When users click on it, it will open up template.php and the information will be drawn from id 31.
I hope this makes sense.
-
while ($aC = mysql_fetch_arrray($rC))
You have "mysql_fetch_arrray" with an extra "r".
-
If you do as described and you get the list of models, and then pull the data (sold or unsold) into an array, the model and the information of whether it's sold or not, will share the same index number.
i.e.
Model: Status:
MKX Sold
Sable Unsold
Milan Unsold
Mariner Sold
$models[0] = MKX & $status[0] = Sold
$models[2] = Milan & $status[2] = Unsold
-
Also utilize the "mysql_error" function in order to get the errors to return. This will help narrow down the problems.
From what he is describing, the query isn't failing, it's just not happening, because it fails the PHP IF statement.
I may be mistaken though.
[SOLVED] PHP Search engine troubles
in PHP Coding Help
Posted
No problem, sometimes all it takes is another set of eyes. If you have any more questions, feel free to post here, also welcome to contact me directly through AIM or MSN etc.
A quick pointer: Use some "debugging" skills. You noticed it wasn't changing the results, therefore it isn't understanding something or it isn't getting all the information. What I normally do then, are "echo" out variables after if statements to see if they passed and if the variables look as they should. Hope that helps.