neas Posted April 7, 2009 Share Posted April 7, 2009 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); ?> Quote Link to comment https://forums.phpfreaks.com/topic/153082-solved-php-to-php-class/ Share on other sites More sharing options...
MadTechie Posted April 8, 2009 Share Posted April 8, 2009 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! Quote Link to comment https://forums.phpfreaks.com/topic/153082-solved-php-to-php-class/#findComment-804075 Share on other sites More sharing options...
Maq Posted April 8, 2009 Share Posted April 8, 2009 Don't go anywhere, I'm almost done. Quote Link to comment https://forums.phpfreaks.com/topic/153082-solved-php-to-php-class/#findComment-804082 Share on other sites More sharing options...
neas Posted April 8, 2009 Author Share Posted April 8, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/153082-solved-php-to-php-class/#findComment-804084 Share on other sites More sharing options...
MadTechie Posted April 8, 2009 Share Posted April 8, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/153082-solved-php-to-php-class/#findComment-804096 Share on other sites More sharing options...
neas Posted April 8, 2009 Author Share Posted April 8, 2009 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! Quote Link to comment https://forums.phpfreaks.com/topic/153082-solved-php-to-php-class/#findComment-804101 Share on other sites More sharing options...
Maq Posted April 8, 2009 Share Posted April 8, 2009 I just read the stickies at the top, I apologize. Thank you for your time Techie! Stickies are meant to be read before you post, to prevent instances like this, sigh... EDIT: Mark as [sOLVED] if so. Quote Link to comment https://forums.phpfreaks.com/topic/153082-solved-php-to-php-class/#findComment-804102 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.