Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    PHP




Reading An Array Of Records From MYSQL Then "Save As" Them Back As Copy


Hi all,

Ok here is what I want to do then I will show you what I have. I have some records in a MySQL DB that I want to store in an array and then immediately copy them back where the only thing that would change would be one field - the date. So here is my table:
-------------------------------------
|userName | date | value |
--------------------------------------
| theDano | 200005 | 123 |
--------------------------------------
| theDano | 200005 | 345 |
--------------------------------------
| theDano | 200004 | 678 |
--------------------------------------
| joeUser | 199908 | 897 |
---------------------------------------

So if I am querying for the user "theDano" on a specific date (format yyyymm) in this case 200005 (year 2000 month of May)

Here is my array to query all records to fullfill this request:

if ($update=="future")
{
if ($month!="01")
{
$db = mysql_connect("localhost", "dbuser");
if($db)
{
mysql_select_db("dbName",$db);
$result = mysql_query("SELECT * FROM tableName WHERE userName = '$userName' AND date = '$date' ORDER BY value DESC ",$db);
if ($result)
{
$num=mysql_numrows($result);
$i=0;
while($i < $num)
{
$userName = mysql_result($result,$i,"userName");
$value = mysql_result($result,$i,"value");
echo "<tr>";
echo "<td width=Ê×'>" . $userName . "</td>";
echo "<td width=ï`'><div align='right'>" . $value . "</div></td>";
echo "</tr>";
++$i;
}
}
}
}
}

Now I want to take the array of records queried which was:

| theDano | 200005 | 123 |
--------------------------------------
| theDano | 200005 | 345 |

and copy them to look like this back into the database:

| theDano | 200006 | 123 |
--------------------------------------
| theDano | 200006 | 345 |

so you can see that the only thing changed was increasing the month by one. Would seem simple to most but I am having a tough time wirting the code to read the array and increase each date value by "1".

Thank you in advance for anyone that replies. )

Dano




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Preventing Visitors Ability To "re-visit" A Page Via The "back Button"..
I have a rather complex registration/member sign up form.. which gets a little confused, when a visitor "backs" completely out of the form, then for whatever reason returns to the form. The form contains 'cancel' buttons, which naturally cancel the reg process and redirects them to the document just before they started.

JS provides us with the "location.replace()" method, but I can't seem to find a way to coordinate the use of location.replace() with the posting of the form values. In short, I want to "replace" the first step of the form with the "second step".

I think what's making this tricky, is that each step of the form are located within the "same" page (register.php). The document works like so: The first step is the "Member Agreement" when they click "agree" (submit) the system creates a new row in the temporary register table of the db.

It then issues a registration cookie, which carries the row id, and session value. in addition (for those cookie impared users) we carry the row id and session value in hidden elements. So far, as long as the user continues through the process all is fine, but if they (for whatever reason) back all the way out, and click 'agree' again, the process fails.

I guess I have to find a way to force a reload of the 1st step "if they've gone back" OR "replace()" the first step with the second, so as to prevent the user from going "back" to the 1st step of the register page.

Checked Mysql Work Back "ok" Or..
how can i make custom page to checked if Mysql is connect/work/online and if it is ok back "ON" if not back "OFF"?

Sticking "if" Or Changes Within A MySQL "where" Array?
I'm not exactly sure how to even ask the question, and I know my terminology
is not good as I'm a SQL beginner, but, here goes.

I need to find a way to make an if statement within an array...or, the
"while" portion of a recordset.

The best way I can ask is show what I mean.
http://oscarguy.mechphisto.net/awardbrowse.php
If you go there and select an award (like Best Picture), leave the year
field alone, and select YES and submit, you'll see a lot of results. And I
have HR's dividing each entry.

What I need to do is group all the entries of the same year, or at least
only put HR's between the blocks of years.
So, I'd have all the entries for 2002, an HR, then all for 2001, an HR, etc.

Here at the bottom I'll include my PHP code I'm using so far.
But I have no idea where to even start looking for an answer...if it's even
possible.
If someone can just give me the name of the function or process or
technique, then I can go Web/book searching myself...I just need a direction
of where to go.

PHP:------------------------------------------------------------------------
------
$query_RS_award = "SELECT * FROM $award WHERE id != &#391;' ORDER BY year DESC,
w DESC";
//$query_RS_award = "SELECT * FROM $award WHERE year =
"$year"";
$RS_award = @mysql_query($query_RS_award, $connection) or
die("Couldn't query: " . mysql_error());
$totalRows_RS1 = mysql_num_rows($RS_award);
while ($row_RS_award = mysql_fetch_assoc($RS_award)) {
$award_id = $row_RS_award['id'];
$award_tblid = $row_RS_award['tblid'];
$award_award = $row_RS_award['award'];
$award_year = $row_RS_award['year'];
$award_category = $row_RS_award['category'];
$award_won = $row_RS_award['w'];
$award_film = $row_RS_award['film'];
$award_nominee = $row_RS_award['nominee'];
$award_note = $row_RS_award['note'];
if (!($award_category)) {
$award_category = "n/a";
} else {
$award_category = $award_category;
}
if ($award_won == "1") {
$award_won = " - Award Winner";
} else {
$award_won = "";
}
$display_block_Award .= "YEAR:&nbsp;<span
class='normalText12White'>$award_year</span><br>FILM:&nbsp;<span
class='normalText12White'>$award_film</span><br>CATEGORY:&nbsp;<span
class='normalText12White'>$award_category</span><br>NOMINEE:&nbsp;<span
class='normalText12White'>$award_nominee</span><span
class='normalText12BoldWhite'>$award_won</span><br><blockquote><span
class='normalText12White'>$award_note</span></blockquote><hr>";
}

Failed To Connect To Mailserver At "localhost" Port 25, Verify Your "SMTP" And "smtp_port" Setting In Php.ini
Warning: mail(): Failed to connect to mailserver at "localhost" port 25,
verify your "SMTP" and "smtp_port" setting in php.ini

in php.ini I have:

SMTP = localhost
SMTP_PORT = 25
SENDMAIL_FROM = NULL
SENDMAIL_PATH = "H:WINNTsystem32" (this is where sendmail.dll is
sitting. H is the drive with w2k)

Other PHP code on that page is working.

What else should I check?

Fpdf Not Using Specified Filename In "Save As..." Dialogue After Acrobat Upgrade
Using the string:

$pdf->Output("testfile.pdf", I);

the "Save As..." dialogue box does not provide the specified filename.
The default is the name of the PHP page used to generate the PDF.

It worked when using Acrobat 4.0 and since upgrading to 6.0, it no
longer works.

The "D" and "F" switches do parse the correct filename.

Problem exists in both Netscape and IE.

Anyone else experience this and is there a resolution?

"copy()" Function Not Working With File Upload
Below is a multiple-file upload script. The form input part works ok. The variables $FileType, $FileName, $FileSize, $TempName, and $FileError work fine. But just after $FileError (which does not output an error message) the script just stops. The problem appears to be with the "copy()" function. I can simplify the script, make it just a single file upload script, use the variable $userfile for the first part of the "copy() function, and it uploads the file just fine.

The problem is when I try to make it a multiple-file upload script like the one below - then the copy function won't work.

I would appreciate if anyone could spot the problem.

PHP Code:

$Admin[UploadNum] = "10";
if($FileUpload) {
for ($Number = 1; $Number <= $Admin[UploadNum]; $Number++){
if ($FileUpload) {
$FileType = $_FILES["userfile"."$Number"]["type"];
$FileName = $_FILES["userfile"."$Number"]["name"];
$FileSize = $_FILES["userfile"."$Number"]["size"];
$TempName = $_FILES["userfile"."$Number"]["tmp_name"];
$FileError = $_FILES["userfile"."$Number"]["error"];
echo "File Type: $FileType<p>"; // $FileType prints out fine.
echo "File Name: $FileName<p>
"; // $FileName prints out fine.
echo "File Size: $FileSize<p>
"; // $FileSize prints out fine.
echo "Temporary Name: $TempName<p>
"; // $TempName prints out fine.
echo "Error Message: $FileError<p>
"; // Does not output error message - appears to work fine.
// ------------ The script stops working right here ------------
if (copy ($_FILES['userfile'.'$Number']['name'], "users/".$_FILES["userfile"."$Number"]["name"]."")) {
    echo "Your file was successfully uploaded!<p>
";
} else {
    echo "Your file could not be copied.<p>
";
}
}
}
unlink ($userfile);
}else{
echo "<form action="$PHP_SELF" enctype="multipart/form-data" method="post">
";
for ($Number = 1; $Number <= $Admin[UploadNum]; $Number++){
echo "<input name="userfile"."$Number" type="file" size="25">
";    
}
echo "<input name="FileUpload" type="submit" value="Upload Files"></form>
";
}

How To Get Return Status Of "Save-As" Dialogue Box ?
I am displaying "Save-As" dialogue box

header("Cache-Control: public, must-revalidate");
        header("Pragma: hack");
        header("Content-Type: " . $this->mime);
        header("Content-Length: " .(string)($fsize) );
        header('Content-Disposition: attachment; filename="'.basename($this->path.$this->name).'"');
        header("Content-Transfer-Encoding: binary
");

using "header()" function. But how to know that user has clicked "save" button or "cancel" button.

Force Reload Of Page When User Press "Back" Button
Is there a way to force a page to reload if a user har pressed the "Back" button in the browser.

"Warning: Page Has Expired" - How To Aviod When Using Browser Back Button?
In summary:
I want to a form to submit information via a HTTP POST, however, when using
Internet Explorer I want to be able to use the back button and all the
information retained. Presently we get a "Page has expired" message. How can
we avoid this?

Full details:
Having searched for postings on how to avoid the "Page has Expired" they are
numerous, however, I have not found one that answers the question
adequately.

Hence this posting.

One posting directed me to the following webpage:
http://in.php.net/session_cache_limiter

but I played around with "session_cache_limiter()" and it did not give the
desired results. (It seem to make no difference). Also many people say to
use HTTP GET instead but this is not an option in this case.

Where can I find concise definitive information on how to avoid "Warning:
Page has Expired" and allow the user to press the back button and see the
form as it was before they submitted it?

'echo "": No Such File Or Directory" Error Using "exec" To Pipe In PHP Script
[TCL]
set php {<? print_r("Hello World"); ?>}
puts $php; # PRINTS OUT <? print_r("Hello World"); ?>
puts [exec "echo '$php' | php -q"]
[/TCL]

When I try this within TCL I get the following error:

Re-Directing Back To "Sort After" Page&
I am using sessions and a MySQL user database to restrict users to certain pages on a website. If the user has not logged in and tries to access a protected page they will get the login page.

Now if they are trying to acess a page like specials.php and they have to logon to access that page, then they get the login page and they then enter login details to access it. If their login is correct, I send a header Location to the Index of the site. How do I direct the user to the page they were looking to access(specials.php) without getting directed to the index.php page. I want to implement this function to all the restricted pages. I know its something pretty simple... maybe keep the url of the "sort after" page in a variable and then re-direct to that page after login ? Can someone give me a hint

Thanks

Getting Link To Act As "back" Button?
I've wrote a script that does calculations based on user input from two select boxes and two text fields. The results of the calculations show up on a second page. Where I'm having difficulty is I put a "try again" link on the results page to take the user back to the input page, which refreshes the page. When the "back" button is used on the browser, though, the info the user input/chose is still there. Most of the time the user will only need to change one field for multiple calculations, so the "back" button is ideal.

Is there a way I can make the "try again" link act as the "back" button on a browser?

How To DISABLE "BACK" When Doing Forms
I want to be able to disable the back button when someone submits a form. Right now i have a page like, questions.php

When the person submits it, it inserts into database. But my problem is this: After the person submits the form, if he/she clicks back and then submits again, it will screw up the data in the DB. How would i be able to do with this php, perhaps hidden tags? session?

How Do I Do Something Like $color = ("red", "yellow", "blue")[$colornum]?
How do I take an index of a literal array, instead of a variable?

That is, say I want to get the short name of a month. Can I do
something like:

$monthname = ("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug",
"Sep", "Oct", "Nov", "Dec")[$month];

or do I always have to do:

$blah = array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug",
"Sep", "Oct", "Nov", "Dec");
$monthname = $blah[$month];

It seems a shame to have to create a variable specifically for this
one-shot purpose.

Mysql/php - "LIMIT" And "ORDER"
In the following fragment of code, I am querying a database that in order to display a list of films. The list is very long and I would like to offer the possbility to restrain the range of results showned by page keeping in mind that the user should be able to browse forward or backward data if applicable. I know that I have to add the LIMIT method in the MySQL query but I have a hard time figuring how not to get lost in setting it dynamically in the PHP script.

Then I have a second question. Is there a more elegant / straightforward way to deal with the display order of the data (cf. $ot, $od and $oy)? Code:

How To Save A "get" Element From An Url
Is there a way to save a url's "get method" part and save it to a variable? let me show you an example.

I have a url like this in browsers address bar->  http://www.mysite.com/?page=about-us

Now I want to save "about-us" in a variable and do a mysql query about it! Is there a way to do this without knowing the actual statement after ?page=  ?

Reading A "live" Log File?
I have come across a situation where it would be useful to read new lines being added to a log file on the users system. I have never seen anything like this discussed before so was curious if anyone had any prior experience with something of this nature. I am familiar with reading and writing to text files but not in real-time constantly.

Reading Only The Last Number From I.e. "1234" (4 That Will Be)
as 1st, sorry on my clumsy english (now I realy miss some words)

I have one language specific problem with my site. I would like to tell
how meny pictures someone have in his or her gallery and I would like to
have it properly speled (in Croatian). So, I don't want to write:
"number of pitures in this gallery: 123" rather "John have 123
pictures"... but, here is my problem, I will write now some little
Croatian with differences in capital letters:

1 slikU
2 slikE
3 slikE
4 slikE
5 slikA
6 slikA
7 slikA
....
20 slikA
21 slikU
22 slikE
23 slikE
24 slikE
25 sliKA
....
99 slikA
100 slikA
101 slikU
102 slikE...

so that is pattern:
all numbers which ends with 1 need to have "U",
2-4 = "E"
5-x0 = "A"

and question: how to read only the last number from count(*) ?

Refreshing On "Back"
I want the page to refresh (the script to run again) when the user presses Back button.

"Array To String Conversion" Error When Constructing A Multi-dimensional Array
I'm a bit stumped as I am getting a "Notice: Array to String
Conversion" error when trying to do something that on the surface
should be a very simple task - create an array, and write a set of
values to them based on data submitted from POST Fields.

Code below:

$_SESSION["increment"] = array();
$x = 0 // Counter - This will be
incremented

$_SESSION["increment"][$x] = array("increment_bond" =>
$_POST["increment_bond"],
"increment_amount" = $_POST["increment_amount"],
"increment_comm_date1" = $_POST["increment_comm_date1"],
"increment_comm_date2" =$_POST["increment_comm_date2"],
"increment_comm_date3" = $_POST["increment_comm_date3"]);

It keeps throwing out that error, and does not write any of the POST
Values to the array (the POST values are definitely getting sent, so
that is not the problem).

If I dump out the value of $_SESSION["increment"], I get "1A" ?!?

I'm sure that there is a pretty simple mistake lurking somewhere - I
just can't seem to figure it out.

Errors Won't Show Up Even With Error_reporting(E_ALL) And Ini_set("display_errors","1")
Here's my code:

<?php

error_reporting(E_ALL);
ini_set("display_startup_errors","1");
ini_set("display_errors","1");

wefw
wefwef=wefwe
2349023909()
;wrgwrg ====232

phpinfo(); ?>

I get a blank page.

If I take out the crap, it prints phpinfo() just fine.

PHP 4.3.something...

Pagnation - Limit Number Of Pages Between "Previous" & "Next" Hyperlinks
Was hoping for some advice with a part of page navigation....

It works at the moment so there is a "Previous" & "Next" Hyperlink underneath the records. In between the Previous & Next links are the number of pages that there is of these records. e.g:

Previous 1234 Next

This is fine if there are only a few pages of records, but when there are hundreds of pages the numbers are listed and they take up half the web page with them.

How can i make it so only limited 10 numbers of pages say appear between the "Previous" & "Next" Hyperlink and as you progress through the pages they are as do the next 10 numbers of pages? Code:

[regex] Stripping Out "name" And "value" Values Out Of Tags, Aaargh
Searched through the site, but couldn't find the right regex syntax I was looking for.

the thing i want is, to extract with preg_match_all the given values in a tag...

ex.

$str = '<input type="text" name="name" value="value">'
$pattern = some magic stuff I need to know
preg_match_all($pattern, $str, $result);

And in result I want to have the values text, name and value AND it's important that the order doesn't matter
so structure of tags can be <input type =name= value=> or <input name= class= value= type=> etc, etc...

Group Mailing, Want To Suppress All The "to" Addresses In The "to:" Field
I want to do a mass emailing for a club.
I don't want all the clubs members to see all the addresses of the
other club members for privacy reasons.

How do I set up the php mail function to not display the recipients
email addresses, just to display something like, "U7 Soccer Club
Team"?

'Parse Error' Problem In "isset" And "empty"
I've been having some problems with a parse error that I can't figure
out (PHP 4.3.11 on Solaris9). Sample code:

<?php
// getting strange parse errors on this
class A {
var $value;
function A() {
$this->value = 1;
}

function getValue() {
return $this->value;
}
}

$a = new A();
if (!empty($a->getValue())) {
echo "success";
}
else {
echo "failure";
}
?>

The result of this is:

Parse error: parse error, unexpected '(', expecting ')' in
/foo/public_html/parse_errors.php on line 15

I also get the same effect with "isset", however, testing with "is_null"
or "is_int" produces the correct ("success"/"failure") result. Any ideas?

Value Of Variable Shown As "Array" When From Included File
I have this statement to find the latest date that a row was inserted
________

$entry=mysql_query("SELECT contact FROM board ORDER BY contact DESC
LIMIT 1")or die ("Query failed:<br>$entry<br>Error: " . mysql_error());

while($myrow=mysql_fetch_array($entry)){
if (ISSET($myrow['contact'])){
$latest = date("d M y", ($myrow['contact']+50400));
}
}
________

This reports the value for $latest correctly if the statement is in the
document.

However when the statement is in an included file the reported value for
$latest is ... Array

Where am I going wrong?

Why Does The Word "Array" Show On A Select Query
I am new to php and MySQL and I'm attempting to run a select query on a
MySQL database which is working fine except prior to displaying the table
with the results from the select query it displays 1 line for each row in
the database containing only the word Array. This is then followed by the
correct results in the constructed table. I am not storing the string
"Array" in my table.

Following is the PHP code for constructing the table from the results
variable.

for ($i = 0; $i < mysql_num_rows($result); $i++)
{
echo "<tr>";
echo $row = mysql_fetch_row($result);
for ($j = 0; $j < mysql_num_fields($result); $j++)
{
echo("<td>" . $row[$j] . "</td>");
}
echo "</tr>";
}

I hope this is enough of the PHP script to solve the problem

Echo "<!--#include File="top.html" -->";
I have a search script which returns a page of results, however I'd like the returned page to be in the same format as the rest of my site.
To do this I've tried adding the HTML for my site to my PHP page with echo" " commands. This works for the plain HTML, but my regular pages also use SSI to do other stuff (some of them even execute other PHP scripts to generate tables of data etc). I've tried

echo "<!--#include file="top.html" -->";
but it doesn't work as I get a parse error. My question is, how do I go about doing this properly? Is this possible at all? And if not have you guys got any suggestions to get around this?

Any File Size Limit In <PARAM Name="***" Value="***"> ?
I embed an applet in my php script which has a parameter providing an
input file for the jar. Does this file has size limit?

The code is as follows:
<APPLET ARCHIVE="myapplet.jar" WIDTH=372 HEIGHT=360 VSPACE=0 HSPACE=0
ALIGN=middle>

<?php echo "<PARAM NAME="data" VALUE="myfile.">";?>

when "myfile" is beyond 15M, my applet cannot load sucessfully, but
while this file is limited like 5M or 7M, it works well.

Does anybody know is the reason caused by php script limit, applet
mechanism, or by different browser?

How To Do PHP "require()" Or TCL "source" In Bash Script
I can't figure out how to explain this any better than
this.

In PHP we have a command "require()" that obtains a file and logically
places it into another file.

I cannot figure out how to do this in bash script as the requirement
is necessary for a migration script to obtain the code from a .cfg
file and then be able for the "parent" script to run the code it
"imported" from the .cfg file, much like PHP's require() or TCL's
"source".

This is what I have so far and it fails:

if [ -f ivc.cfg ]; then
cat ivc.cfg
fi

Anyone really know bash script well please help, it's a barrier for me
not to be able to get just this one piece working.

Fwrite Seems To Add In Unwanted "Array" String
Whenever I add a string to a file usind the folling code it adds "Array" to the begining or end of the string added to the file.

$file = $filename;
$descriptor = fopen ($file, "a");
$contents .='heh'
fwrite($descriptor,$contents);
fclose($descriptor);

I have played around with the "a" and tried "w" and "a+", but the "w" will not contain the "Array" string but will over write the files contents.

Checking If A Multi-dim. Array Has Been "filled Out"
I have the following recursive function which is supposed to check wether a multi-dimensional array has any "blank spaces" in it. PHP Code:

Passing Array For MaxOccurs="unbounded"
I have problem with passing parameters for web service.
Address for WSDL 'http://www.odfl.com/RateWeb/wsdl/com/odfl/ws/
rateestimate/RateEstimate.wsdl'.
Im trying to call calculateRate in wsdl there are three elements with
maxOccurs="unbunded" when i'm trying to pass them as array i receive
error "org.xml.sax.SAXException: WSWS3084E: Error: SimpleDeserializer
encountered a child element, which is NOT expected, in something it
was trying to deserialize. Message being parsed: "
If i pass it as single value a receive normal response with error
codes because for each element 5 values are required.
I've tried PEAR::SOAP and nuSOAP changing style or transport is not
working either.

Function Doesn't Return If "load" Is An Array Value
I have created a simple function to load an array with name / value pairs, and return the array. Most of the time it works as expected, but one particular name / value pair causes the function not to return. No errors are reported.

My system details:

OS: Windows XP SP2 ("Windows NT OFFICE 5.1 build 2600" reported by phpinfo)
Server: XAMPP for windows (apache)
PHP Version: PHP Version 5.1.4

The function: Code:

Error In Page When Checking Http_get_vars("myvar") And "myvar" Was Not Passed In URL String
PHP, coming from ASP coding

if (HTTP_GET_VARS['b']==1){
print "Yes";
}else{
print "No";
}

when "b" is not passed via
(http://www.mydomain.com?b=1

an error occurs and the "NO" is printed but an error is printed too.

How can I check for the value of "b" so that no error occurs if b is
not passed??

example

http=www.mydomain.com

$myvar=HTTP_GET_VARS['b']

causes an error because
"b" does not exist (ie. its not passed in the URL string.

$myvar maybe evaluated as NULL or Empty but the error is printed in
the page, anyway.

How Do I Put SELECT Statement Into "for" Array?
Does anyone know how I can put the SELECT statement below into a for array?

"struct" Vs. Assoc. Array
To handle a collection of data, I could use an associative array or a class.
Provided I don't need any of the functionalities classes offer, i.e. use
it as a struct, what is the better option in terms of speed?

"refreshing" An Array[] In A Loop?
The following is part of a script meant, ultimately, to test the co-attendance percentage of members to find who attend and who do NOT attend simultaneously. The script below loops throgh the names of the members and is supposed to dump all the years into an array which gets reset for each member.

1) The array $attended_others[] keeps building and needs to be reset each time through - i.e. for each member. I see no array function that allows you to clear the array - I hope there is a way? PHP Code:

Checking An Array And "splitting It Up"
I'm trying to create an image upload class and got into a little array problem. (File is attached to post. Sorry for the Icelandic) I pass the $_FILES['someuploadfiles'] to $this->uploadskrar and then in skoda() I cycle through the array and the if/else sentence is to filter out the bad apples, the images that don't f meet the standards set,

$this->ilagi_myndir is for pictures that meet the standards and $this->nilagi_myndir is for pictures that don't meet them. Those 2 arrays are are suppose to have the same structure as $this->uploadskrar and i'm not figuring out how.

Passing Array In Url Without "serialize"?
is it possible to pass on an array in the url without using the serialize/unserialize, urlencode/urldecode stuff? I mean something like:

myscript.php?array[1]=value1&array[2]=value2
or
myscript.php?array[]=value1,value2

thing is I know I once read about it being possible, but cannot find any more the correct syntax for it.

Array Sorting Like "order By" In Sql...?
I just want to sort the secArray as first array descending & within that descending values, third array elements should be in assending order. Code:

Domain "Extension" Array
I want to take input from $_POST['website'] and put it in a variable, then I want to check whether or not one of these domain extensions were entered (of course there are more than 6 extensions, but this is for testing). Is there a better way of doing this or am I on the right path?

//validate website posted. Domain was entered.
$website = $_POST['website'];
$domains = array("com", "net", "org", "edu", "us", "biz");
if (!in_array($website, $domains)) {
$error .= "<p class='error'>Enter the web address in the correct format.</p>";
}

Hundreds Of "array" Queries
When I look at MySQL process list in PHP MyAdmin from time to time I see hundreds of "Array" SQL Queries and with status "locked". What is it?

Error Using Header("", FALSE) To Show Multiple Images From MySQL Db
Many people seems to have problems when displaying multiple images from their database (mySQL db). Often you can read error statements like "Header already sent out ...". To solve this, people often propose to use include files.

To keep the scipt it would be nice not having this problem, being able to sent out multiple headers to a browser without getting these error messages. In the PHP4 manual, we can read an option that can be added to the header statement, Header("xxx",FALSE). It would enable multiple headers to be sent out.

For instance the following statement:

while ($product = db_fetch_object($result)) {
header("Content-type: pv($product->filetype)",false);
echo pv($product->image)"
}

However, it doesn't work. Anybody has any idea why? Does anybody use this option FALSE with success?

PHP "Calender Like" Pop Up To Select Date And Store As Variable In Mysql Format?
I use to have this feature on my site about two years ago when i hired someone. It would allow the user to select between two different dates, via a small calender, save it as a variable then query the database.

Does anyone know where I can find the script for the small calender? I think it must of been populated by an external clock since all the dates were accurate etc. July 21st was on a saturday.

"Supplied Argument Is Not A Valid MySQL Result Resource"
this is one of the first scripts im writing completely by myself but its driving me crazy. the errors its returning are:

Quote: Warning: Supplied argument is not a valid MySQL result resource in c:apachehtdocsquiz_chap12_view.php on line 16

There are currently in the table: PHP Code:

Why Is My MySQL Table Building An "Overhead"/what Is That/how Can I Prevent It?
I hope you'll be nice to me and let this post go through even know its
mysql and not directly php. But of course my script is php.

The problem is, that my Table (1,8 MIO entries/100 MB/MyISAM) is not
working anymore. Everytime my script wants to write in something the
number of entries decreases, and at the "Overhead" column the number is
growing.

How can I make my table work without that overhead problem, without any
further crashes and without loosing my data?

If I use the repair or optimize function (phpmyadmin) the overhead is
deleted, but the data is still lost, and the next time my script trys
to put in something more entries will be deleted.

PHP/MySql On Window XP "Wrong Username/password"
I installed both, 1st mysql 4.1.7 but heard there was a change
with password hashing so now got 4.0.9

Basically when I choose a page with php_info() I can load it fine,
but when I call a php page with mysql connections I get an Window NT
prompt, which I type either mysql or window username/password
combinations and always get "Wrong username/password"

Any idea what it might be...all permission on the directory are open
for IUSER_MACHINE name which is the account that anonymous access users
come in on. Other pages seem fine, but one that want mysql access do
this funny thing...I did the default mysql installation I think root
password was blank, I set it to something else, but now when I login
using the mysql command line it doesn't like the password I just set...

Problem With ""s Entering Stuff Into A MySQL Database
I have a database which is going to be used partly to store articles, which will basically be free-flowing text. So what if someone puts a single comma ' in? Because I am using the PHP:

$query = "INSERT INTO quasimodo VALUES ($iNum,'$area','$sec1','$sec2','$sec3','$name','$phone','$email','$body')";

So surely when someone types the words it's or something like that with an apostrophe in the middle, it'll screw everything up? The stuff will be entered through a form. Please, how can I get around this problem? A similar problem would arise if i used "$body" instead of '$body' because someone might put a word in "inverted commas".


Copyright © 2005-08 www.BigResource.com, All rights reserved