Jump to content

Recommended Posts

Hi,

I am using AMFPHP and I was wondering if anyone could re-write this as a php class for me so amf can recogize it. Thanks,

neas

 

 

 

 

<?php
$link = mysql_connect('mysql.site.com', 'site', 'sitepass' );
if (! $link) print 'Failed to connect.<br>';
$rcode = mysql_select_db('db');
if (! rcode) echo 'Failed to select database<br>';
$sql = "INSERT INTO users (password, lastname, firstname) " .
      " Values ( 'password', 'fname', 'lname'); "  ;
echo $sql . '<br>';
$result = mysql_query($sql);
if (! $result) echo 'Failed to insert<br>';
mysql_close($link);
?>

 

Link to comment
https://forums.phpfreaks.com/topic/153082-solved-php-to-php-class/
Share on other sites

Of course.. its not like you havn't read the rules or anything.. i'll start right after i get the transction id for my paypal payment! ::)

I read them, but I figured I would just ask for the hell of it, if you could redirect me to a tutorial of some sorts showing me how then that would be great.

i don't use AMFPHP but to put it in a class

<?php
class SimpleClass
{

function __construct()
{
$link = mysql_connect('mysql.site.com', 'site', 'sitepass' );
if (! $link) print 'Failed to connect.<br>';
$rcode = mysql_select_db('db');
if (! rcode) echo 'Failed to select database<br>';
$sql = "INSERT INTO users (password, lastname, firstname) " .
      " Values ( 'password', 'fname', 'lname'); "  ;
echo $sql . '<br>';
$result = mysql_query($sql);
if (! $result) echo 'Failed to insert<br>';
mysql_close($link);
}
}
?>

 

usage

<?php
$myclass = New SimpleClass();
?>

 

Don't ask someone to write or re-write a script for you, unless you are posting a message to the Freelancing Forum. The forums are not the place to request XYZ script. This is a community of people learning PHP, and not a script location service. Try searching SourceForge, PHP Classes, HotScripts, or Google.

 

Pick the right forum for your question. If you have a Database-only question, post in the database section (MySQL/etc). If you have an OOP question, post in the OOP board.

 

 

 

i don't use AMFPHP but to put it in a class

<?php
class SimpleClass
{

function __construct()
{
$link = mysql_connect('mysql.site.com', 'site', 'sitepass' );
if (! $link) print 'Failed to connect.<br>';
$rcode = mysql_select_db('db');
if (! rcode) echo 'Failed to select database<br>';
$sql = "INSERT INTO users (password, lastname, firstname) " .
      " Values ( 'password', 'fname', 'lname'); "  ;
echo $sql . '<br>';
$result = mysql_query($sql);
if (! $result) echo 'Failed to insert<br>';
mysql_close($link);
}
}
?>

 

usage

<?php
$myclass = New SimpleClass();
?>

 

Don't ask someone to write or re-write a script for you, unless you are posting a message to the Freelancing Forum. The forums are not the place to request XYZ script. This is a community of people learning PHP, and not a script location service. Try searching SourceForge, PHP Classes, HotScripts, or Google.

 

Pick the right forum for your question. If you have a Database-only question, post in the database section (MySQL/etc). If you have an OOP question, post in the OOP board.

 

 

I just read the stickies at the top, I apologize. Thank you for your time Techie!

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.