Pikachu2000
-
Posts
11,377 -
Joined
-
Last visited
-
Days Won
11
Posts posted by Pikachu2000
-
-
It seems so. I wrote a quick workaround for it, maybe you could incorporate it into a function and use it.
$occurrence = 'first'; $day_name = 'thursday'; $month = 'April'; $year = 2010; $date = (int) date("d", strtotime($occurrence . " " . $day_name . " " . $month . " " . $year)); if( $occurrence == 'first' && $date >= 8 ) { $date -= 7; } echo $date;
-
If there are spaces in the field, you'll need to use urlencode(). If you suspect you're not using urlencode() properly, show us an example of how you were using it in the script, and maybe someone can help you with the syntax.
-
NOTE: For grins, I just tested this on my installation (5.2.12) and the bug still seems to be present. It still returns 8.
-
In PHP 5 prior to 5.2.7, requesting a given occurrence of a given weekday in a month where that weekday was the first day of the month would incorrectly add one week to the returned timestamp. This has been corrected in 5.2.7 and later versions.
-
Of course, what PFMaBiSmAd just posted is also possible. Additionally, if you execute an identical UPDATE query multiple times, it will return "0 row(s) affected", because no fields were changed after the first UPDATE, even though the subsequent queries succeeded.
-
Are you sure the query failed? I created your table locally, and ran the query, both with all fields in backticks, and with only `Kill` in backticks, and it executed successfully both times.
-
What error are you getting?
$result = mysql_query($query) or die(mysql_error());
Also note that form data should NEVER be allowed in a DB query without being properly sanitized with typecasting, trim()ing, mysql_real_escape_string() etc.
-
No problem at all . . .
-
at the top of all scripts using $_SESSION data: session_start();
$_SESSION['id'] = mysql_real_escape_string(trim($_GET['id'])); (if id is a string)
-OR-
$_SESSION['id'] = (int) trim($_GET['id']); (if id is an integer)
Regarding session_register(): "This function has been DEPRECATED as of PHP 5.3.0. Relying on this feature is highly discouraged."
-
I don't see where you are assigning the $_GET['id'] value to the $id variable. If this method worked on other installations, it probably relied on REGISTER_GLOBALS = On.
Also, change your tags from the short open <? tags to the standard <?php open tags, and remove the single quotes from WHERE id = '$id' as integers should not be quoted in DB queries.
$id = (int) trim($_GET['id']) // assuming id should always be an integer, trim spaces and typecast it as (int) for the DB query
-
So, you want to display a table with 30 fields regardless of how many records are returned in the DB query, is that correct?
-
If I'm reading the question right, you want to be able to edit what is returned from the DB and update those same DB fields with the data entered in the form fields, correct?
If so, to populate the text areas use
echo '<input type="hidden" name="record_id" value="' . $row['record_id'] . '" />' echo '<textarea name="question" rows="3" cols="40">' . $row['question'] . '</textarea>';
Then when the form is submitted (check for submission with an isset() ), sanitize the input and run the UPDATE query, setting the fields to the new values WHERE the db_record_id = submitted_record_id.
-
I just figured out what is going on here. If you typecast the $xx variable as an integer when you assign its value from $linknum, it works just fine. I also made the code a little more compact by eliminating redundancy in assigning values to variables.
<?php $xx = (int) $_GET['linknum']; // typecast as an integer here, now the != comparison works when value is passed via URL. $data = file ("Source_file.txt"); $b = fopen("New_File.txt", "w+"); foreach ($data as $zz) { if ($zz != $xx){ fwrite($b, $zz); } } ?>
-
Try checking what happens in the conditional . . .
if(strpos($line,"<indexTitle>")) { //Look for indexTitle tag echo 'Found tag in $line'; $indexTitle = $line; //Set indexTitle as the current line $indexTitle = str_replace("<indexTitle>", "", $indexTitle); //Strip both indexTitle tags $indexTitle = str_replace("</indexTitle>", "", $indexTitle); } else { echo 'Did NOT find tag in $line'; } }
-
On second look, nevermind. I see you're simply passing the value in the URL. I just changed it a little to read the values from an an array, and then echo the result instead of writing a file and tested it locally, and it seems to work just fine.
-
It would be helpful to see the form you're using to submit the data to this script.
-
In the script, you call settings.xml, but below you specify the filename as settings.php. Is that just a typo?
-
You just need to figure out where to start the numbering with a simple query to set the initial value of $i .
$query = "SELECT index FROM tbl_name WHERE some_field = 'some_value'"; $result = mysqli_query($dbc, $query); $i = mysqli_num_rows($result); while( $array = mysqli_fetch_assoc($result) ) { echo $i . " - " . $array['index']; $i --; }
-
I'd start by echoing the query, then pasting it in to phpMyAdmin, or the mysql> client to see exactly what it returns, then debug from there.
-
Set a variable to integer 1, then echo and increment it in the while statement.
$i = 1; while( $array = mysqli_fetch_assoc($result) { echo $i . " - " . $array['index']; $i ++; }
-
Just noticed this: if (!matches) should be if( !$matches ), or better yet, if( $matches == 0 ) I would think.
-
Temporarily comment out the mail() function, and echo the $body variable instead so you can see if $body holds the data you'd expect it to hold.
-
If there are only 8 records, you can't expect it to retrieve and display 10 of them. But are you saying the loop displays the same record 8 times instead of displaying all 8 of them? The query looks off to me. You are assigning the value to $post_tilte outside of the while{} loop, therefore it never changes. Try this, but note that I didn't correct the spelling of title, so you'll need to edit that if you corrected it locally.
<?php include 'connect.inc'; echo "recent posts"; $query = "SELECT tilte FROM comments ORDER BY date DESC LIMIT 10"; // separate the query, and you should only select necessary fields rather than wildcard * all $result = mysql_query($query); //execute the query while($array = mysql_fetch_assoc($result)) { echo $array['tilte']; } ?>
-
Are there 10 records in the database table, or only 8?
What is this error, i've never seen it before??
in PHP Coding Help
Posted
It sounds as though directory quotas are enabled, and the directory is full. Is the web server running on your laptop, or is this a hosted site?