Here is a basic (untested) example.
$link = mysql_connect("localhost", "username", "password");
mysql_select_db("database", $link);
$result = mysql_query("SELECT product_name FROM products", $link);
$num_rows = mysql_num_rows($result);
// read in data
while ($row = mysql_fetch_array ($result
You could use continue to skip to the start of a loop.
e.g.
while (1)
{
start of code you want to jump back too
.
.
.
if (so and so is true) continue;
.
.
.
.
break; // exit loop
}
Unlike c php does not have a goto command.
However what you describe does not sound
Under linux you can use lynx to run php scripts under the shell.
e.g.
Assuming lynx is setup correctly
lynx -source
your.server.com/devel/newtrlkit/test.php?param=whatever>test.txt
-Stewart
-Original Message-
From: Brandon Orther [mailto:[EMAIL PROTECTED]]
Sent: 03 April 2001 17:02
To:
$addr = "[EMAIL PROTECTED]";
$splitaddr = explode("@",$addr);
resulting in $splitaddr[0] = "test";
$splitaddr[1] = "foo.com";
-Stewart
-Original Message-
From: Jacky [mailto:[EMAIL PROTECTED]]
Sent: 29 March 2001 23:52
To: [EMAIL PROTECTED]
Subject: [PHP] split string v
Swap your indexes round
i.e. $list[$r]["priority"] changes to $list["priority"][$r];
This,
$list = array_multisort($list["priority"], SORT_NUMERIC, SORT_DESC);
should work ok now.
-Stewart.
-Original Message-
From: phpman [mailto:[EMAIL PROTECTED]]
Sent: 28 March 2001 03:33
To: [EMAIL
You can use the strip_tags function to remove HTML tags from the user
inputted data
e.g. $name = strip_tags($name)
-Stewart
-Original Message-
From: Brian Rosenkrantz [mailto:[EMAIL PROTECTED]]
Sent: 22 March 2001 15:50
To: [EMAIL PROTECTED]
Subject: [PHP] Unwanted signs!
I'm new to ph
i fixed that it said wrong
perameter count for fopen() on the third line, and "Warning: Supplied
argument is not a valid File-Handle resource" for the remaining lines below
that in that block of code.
i'm sorry, i'm kinda new to this : (
"Stewart Taylor" <[EMAIL PRO
You need to add '[]' to the selects name which informs php that the select
field will have more than one value.
Once your form has been submitted an array called $comboResultPlan will be
available containing the selected options.
-Stewart
-Original Message-
From: Angie Bauer [mailt
You need to copy the contents of the current file.
Then recreate the file by writing the new message then writing back the
original contents.
e.g.
$fname = basename($PHP_SELF). ".comment";
$fsize = filesize($fname);
fp = fopen(basename($fname));
$data = fread($fp,fsize);
fwrite($fp,$message);
fwr
Your need to define $db as a property of your sessions class.
e.g.
class sessions {
var $db;
function sessions {
$this->db = new mysql_connect;
}
function testprint() {
$this->db->connect()
}
}
$sess = new sessions;
$sess-> testprint();
-Original Message-
It would be better to use randomly generated strings for your client ids
e.g. md5(uniqid(rand()));
This would be must harder for another use to guess.
Even better would be to store your users details in a session variable so
that the id will never appear in the url at all.
e.g. a very basic ex
If the number divided by 100 hundred has no remainder
e.g.
if (($num % 100) == 0) even_100 = true;
-Stewart
-Original Message-
From: Nicklas af Ekenstam [mailto:[EMAIL PROTECTED]]
Sent: 21 March 2001 09:38
To: [EMAIL PROTECTED]
Subject: [PHP] Finding every even 100
Hi
Propably a reall
You can give $maybe3 a default value which will be used if it is not passed
in the function call.
You can only do this for the last parameter in the function.
function print_this ($value1, $value2, $maybe3=false)
{
do whatever
if ($maybe != false)
do whatever with $maybe
}
-Stewart
---
Try,
header("Content-type: application/pdf");
header("Location:$filename");
-Stewart
-Original Message-
From: Dennis Moore [mailto:[EMAIL PROTECTED]]
Sent: 21 March 2001 04:14
To: [EMAIL PROTECTED]
Subject: [PHP] PDF reading via IE5.5
I have searched long and hard to resolve this iss
You could try
echo serialize($object_var);
to display the object in it's serialized form.
-Stewart
-Original Message-
From: Thorsten Viel [mailto:[EMAIL PROTECTED]]
Sent: 20 March 2001 12:59
To: [EMAIL PROTECTED]
Subject: [PHP] Easy Object Reading
Hi,
does somebody know a function
include "database.inc"
.
.
.
.
$dbhost='localhost';
-Stewart
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: 20 March 2001 09:26
To: Jason Stechschulte
Cc: 'PHP General List. (E-mail)'
Subject: Re: [PHP] Editing Variables from another script.
Okay, basic
php variables are local by default.
-Original Message-
From: Costas [mailto:[EMAIL PROTECTED]]
Sent: 19 March 2001 10:27
To: [EMAIL PROTECTED]
Subject: [PHP] use strict alternative
Is there a PHP alternative to Perls use strict command.
For anyone who doesnt know Perl, use strict forc
PHPLIB http://phplib.netuse.de/ has a Query class in sql_query.inc which is
used in conjunction with the DB_Sql class.
It can be used to create dynamic insert and update queries by assuming that
global variables exist which map onto a paricular tables field.
You basically name the table and it cr
The javascript syntax is
document.form_name.elements['preq[]'][indx]
-Stewart
-Original Message-
From: Adv. Systems Design [mailto:[EMAIL PROTECTED]]
Sent: 15 March 2001 15:39
To: PHP List
Subject: [PHP-DB] validating checkboxes
Hello all:
I have to validate that AT LEAST ONE check
How about using the array_diff function instead.
array_diff ($array1,$array2) = elements in $array1 not in $array2;
array_diff ($array2,$array1) = elements in $array2 not in $array1;
>From manual:
array array_diff (array array1, array array2 [, array ...])
Array_diff() returns an array cont
An idea is to put the session id in your web page addresses.
e.g. http://level1/level2/12123234234234234234/test.php
Then setup your web server to filter all addresses to remove the session id
from the address before it is displayed in the browser window (you can set
apache to do this) so the use
21 matches
Mail list logo