CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 split variable

Print topic Send  topic

Author Message
arookie

Posts: 12
Posted: 11/29/2007, 3:10 PM

Hi, this is my problem,... I recieve an url variable: mysite.com?sudent=102|Jose|Suares|109

I must split this variable and save each part in a field (code, name, last_name, grade) on a table (automatically before page shows), and display it in a grid.

I searched the CCS tutorial, google, etc. with no luck...

Thanks,

View profile  Send private message
datadoit
Posted: 11/29/2007, 4:01 PM

arookie wrote:
> Hi, this is my problem,... I recieve an url variable:
> mysite.com?sudent=102|Jose|Suares|109
>
> I must split this variable and save each part in a field (code, name,
> last_name, grade) on a table (automatically before page shows), and display it
> in a grid.
>
> I searched the CCS tutorial, google, etc. with no luck...
>
> Thanks,
>
>
> ---------------------------------------

list($field1, $field2, $field3, $field4) = split('|',
CCGetParam("sudent","");

echo "Field1: $field1; Field2: $field2; Field3: $field3; Field4:
$field4";
arookie

Posts: 12
Posted: 11/29/2007, 4:14 PM

Hi, Thanks for your fast response....
I see now how to split the url... but, how I can save each value in it respective field..???

As you can see, Im new in this... :-)
View profile  Send private message
datadoit
Posted: 11/29/2007, 7:49 PM

arookie wrote:
> Hi, Thanks for your fast response....
> I see now how to split the url... but, how I can save each value in it
> respective field..???
>
> As you can see, Im new in this... :-)
> ---------------------------------------

In your page AfterInitialize:

Split out your URL as shown before, then ...

global $DBConnectionDB;
$db = new clsDBConnectionDB();
$sql = "INSERT INTO YourTable VALUES Field1=".$field1.", Field2=".
$field2." WHERE whatever";
$db->query($sql);
$db->close();
arookie

Posts: 12
Posted: 12/04/2007, 8:52 AM

Hi, I really tried to fix this myself, but I couldn.. :-(

this line list($field1, $field2, $field3, $field4) = split('|',CCGetParam("estudiante",""); sends me an error,

Parse error: syntax error, unexpected ';'

... whats worng...???

View profile  Send private message
arookie

Posts: 12
Posted: 12/04/2007, 8:57 AM

I put it in the BeforeShow of the page... is that O.K. ?
View profile  Send private message
arookie

Posts: 12
Posted: 12/04/2007, 9:14 AM

Sorry, found the problem, it needed an extre ')'

but now it sends this error:
Warning: split() [function.split]: REG_EMPTY in ...
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.