Jump to content

SharkBait

Members
  • Posts

    845
  • Joined

  • Last visited

    Never

Everything posted by SharkBait

  1. Perhaps I am doing this wrong (well obviously because it's not working) but... If I am using a function and I need to use a class object within it, should I pass the object also into the function? Would I pass the variable as an optional object? I get the following error: Fatal error: Call to a member function DoQuery() on a non-object in /home/tingram/public_html/feedback/includes/SendEmail.php on line 108 Which I assume is my $MySQL->DoQuery($strqry, $dblink) was not actually initialized in the function itself.
  2. Do you have dreamweaver pointing to the location of the php.ini file? I think that is an issue I had once when I had a dev box running WAMP.
  3. I am getting the following error message from MySQL and I am not sure why it isn't working for all clients that are using it: Warning: MySQL Connection Failed: Client does not support authentication protocol requested by server; consider upgrading MySQL client in /home/feedback/public_html/includes/c-mysql.php on line 24 MySQL Cannot Connect: This is line 24: <?php $this->link = mysql_connect($this->host, $this->username, $this->password) or die ("MySQL Cannot Connect: ". mysql_error())); ?> Why would it work on my computer, but not on another computer?
  4. Ah ok that makes sense! Thanks for the replies!
  5. c-myslq.php <?php if(!defined("DBNAME")) { echo "<p>I cannot locate my database variables!</p>"; exit(); } class MySQL { var $link; var $query; // Database variables var $host; var $username; var $password; var $database; var $results = array(); function Connect($host, $username, $password, $database) { // Connect to MYSQL DB with defined settings from config.php $this->link = mysql_connect($this->host, $this->username, $this->password) or die("MySQL Cannot Connect: ". mysql_error()); // Select database to work with mysql_select_db($this->database, $this->link) or die("MySQL Cannot Select {DBNAME): <br />". mysql_error()); // Return the link to be used later return $this->link; } function Disconnect($link) { mysql_close($link); } function DoQuery($query) { // Basic Query Execution $this->query = mysql_query($query) or die("MySQL DoQuery Error: <br />{$query} <br />". mysql_error()); return $this->query; } function FetchArray($query) { // Retrieve results of DoQuery $this->results = mysql_fetch_array($query, MYSQL_ASSOC); return $this->results; } } ?> search.php <?php require("c-mysql.php"); // UPDATE SugarCRM bu INSERTING a note about tracking numbers // Find out ID for Customer in Sugar // Create new DEFINES for secondary MySQL connection $DBNAME = "sugarcrm"; $DBHOST = "192.168.1.1"; $DBUSER = "userblah"; $DBPASS = "blah"; $MySQLSugar = new MySQL(); $SugarLink = $MySQLSugar->Connect($DBHOST, $DBUSER, $DBPASS, $DBNAME); $strqry = "SELECT id FROM sugarcrm.accounts WHERE name = '{$company}'"; $query = $MySQLSugar->DoQuery($strqry); $companyInfo = $MySQLSugar->FetchArray($query); ?>
  6. Warning: Missing argument 1 for MySQL::Connect(), called in /home/tingram/public_html/feedback/includes/header.html on line 20 and defined in /home/tingram/public_html/feedback/includes/c-mysql.php on line 21 Warning: Missing argument 2 for MySQL::Connect(), called in /home/tingram/public_html/feedback/includes/header.html on line 20 and defined in /home/tingram/public_html/feedback/includes/c-mysql.php on line 21 Warning: Missing argument 3 for MySQL::Connect(), called in /home/tingram/public_html/feedback/includes/header.html on line 20 and defined in /home/tingram/public_html/feedback/includes/c-mysql.php on line 21 Warning: Missing argument 4 for MySQL::Connect(), called in /home/tingram/public_html/feedback/includes/header.html on line 20 and defined in /home/tingram/public_html/feedback/includes/c-mysql.php on line 21 Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'www-data'@'localhost' (using password: NO) in /home/tingram/public_html/feedback/includes/c-mysql.php on line 23 MySQL Cannot Connect: Access denied for user 'www-data'@'localhost' (using password: NO)
  7. Ok I'm new to this whole creating classes thing so I stared simple with a MySQL connector class: <?php class MySQL { var $link; var $query; var $results = array(); function Connect($DBHOST, $DBUSER, $DBPASS, $DBNAME) { // Connect to MYSQL DB with defined settings from config.php $this->link = mysql_connect($DBHOST, $DBUSER, $DBPASS) or die("MySQL Cannot Connect: ". mysql_error()); mysql_select_db($DBNAME, $this->link) or die("MySQL Cannot Select {DBNAME): <br />". mysql_error()); return $this->link; } } ?> But I am having troubles passing the database connection arguments and it is telling me its missing it. This is how I do it: <?php $MySQL = new MySQL(); $MyLink = $MySQL->Connect("192.168.1.1", "user", "pass", "myTable"); ?> What am i doing wrong?
  8. In my blog software (custom built) I am curious if I enter <?php include('somefile.php'); ?> within the body of the post that gets put into the database. When it is displayed it won't necessarily display that file correct? I would I assume have to something like bbcode [require]sometime.php[/require] and have the php process it when it sees [require][/require] I'm trying to make it so I can add little modules that I can display different things (like polls) within my content posts etc.
  9. Woops yea, I meant to put the proper dates Thanks!
  10. You know.. I actually forget what distro I am using on my test machine. Think its Fedora 4. I know the live server is running Ubuntu 6 I'll take a peek at the source and readme files. Thanks!
  11. I have the following tables: board_pcbs id | pcb_type | sap_pn ---------------------- 1 | Type1 | 29-23032-02 ---------------------- 2 | Type2 | 29-30230-01 ---------------------- board_tracking id | type | serial | date_entered ------------------------------------- 1 | Type1 | 1231 | 2007-01-01 00:00:01 ------------------------------------- 2 | Type1 | 2343 | 2007-01-01 00:00:31 ------------------------------------- 3 | Type2 | 2399 | 2007-01-01 00:01:02 ------------------------------------- Now I understand I could of pointed the board_tracking.pcb_type to the board_pcbs.id but this was kind of an envolving project and this is how it is now What I am trying to do is Join board_tracking to board_pcbs so that it will show the sap_pn in the results based on pcb_entries.type = board_pcbs.pcb_type This is how my query looks: SELECT T1.type, T2.sap_pn, COUNT(*) FROM board_tracking AS T1 LEFT JOIN board_pcbs AS T2 ON (T1.type = T2.pcb_type) WHERE T1.date_entered >= '2007-05-28 00:00:01' AND T1.date_entered <= '2007-05-28 23:59:59'GROUP BY T1.type It returns NULL for sap_pn and I am not sure why. I am assuming I am doing something wrong T1.type | T2.sap_pn | Count(*) --------------------------------------- Type1 | NULL | 2 --------------------------------------- Type2 | NULL | 1 ---------------------------------------
  12. Ok, I've been looking around and I am unsure how I would go about recompiling PHP if I need to add in things like PDFLib or cURL etc. On my test server which I don't mind breaking I have 5.0.4 running but I would like to figure out how to get PDFlib running on it. On a live server I have 4.2.2 running and I would like to learn how to recompile it to at least 4.3.2 or even 5.*. Is recompiling PHP fairly involved? Would I download the latest release and use that? I'm looking for a good tutorial and explainations of the steps to recompile. I don't think I've really ever recompiled anything in my life and I want to learn!
  13. I wouldn't even know where to start. I've ajax once to pull mysql data without refreshing the page at a certain interval, but thats it.
  14. and what would the old fashion way be?
  15. I am in need figuring out how to make a processing page with PHP. You know the onces that say: Please wait while we process your order..... Now what my script does it it sends of a cURL request.. and I need to have a screen showing that the order is being processed. Would I use like while loop or something and wait for the return request?? Hopefully this make somewhat sense!
  16. Ah solved it by making a function that returns a value ie: <?php function ClearSession($value) { if(isset($_SESSION[$value])) unset($_SESSION[$value]) return 0; } $_SESSION['rmbrNotes'] = isset($_POST['chkNotes']) ? $notes : ClearSession("rmbrNotes"); ?> Though as I am looking at the above code.. it still isn't quite right is it? If I return 0 will it not set the $_SESSION variable??
  17. But I guess its erroring because like you mention how it sets the first variable to whatever is being assessed? so $_SESSION['rmbrNotes'] Cannot Be set to unset() right?
  18. I did but i guess i should of shown what I was doing that was erroring on me: <?php $_SESSION['rmbrNotes'] = isset($_POST['chkNotes']) : $notes ? unset($_SESSION['rmbrNotes']); ?> I get this error: Parse error: parse error, unexpected T_UNSET in /home/tingram/public_html/testsite/test.php on line 236 So i thought it it was I couldn't run functions after it, so I posted a more simpler version of what I wanted to do
  19. I can't do this can I? <?php $value = !empty($_POST['value']) ? $_POST['value'] : $message .= "You forgot something"; ?>
  20. I would have to agree with that. I've come home drunk but programming is the last thing on my mind hehe
  21. Hi, I am trying to figure out how blog Ping/Trackbacks work and wondering if anyone out there knows? I had the bookmark for a PHP Tutorial for getting them to work with a non-WordPress blog but I can't seem to find it and it was what I needed. I believe with php I need to look at the XML-RPC part, but curious if anyone out there has done this sort or thing or might be able to point me in the right direction! Thanks!
  22. Well i was thinking because of the items I have on the left side column (recent visitors, the poll etc) if I wanted them to be more visible upon arriving at the site I would want them on the right side. I'll keep it as 2-column. I took out most of my AdSense, the blog has been up for 9 months and I've made a total of $13 I just don't get the traffic that AdSense would require to make money off of it. I'll try the donate button or something. I've been working on a couple of other sites for a couple clients and wanting to take the web design/development to the next level. My blog is more for fun and learning. Thanks
  23. I really don't like the flash thing. It has nothing to do with the site and just for it to say welcome?? I agree that the menu items should be Left Aligned if they are on the left side of your website. To have them right aligned just seems kind of odd. I also think you should of some sort of hover on the menu links too, makes them stand out a little bit, perhaps increasing the font size as well could help. The logo looks like you took the font in Photoshop and added like a 50px stroke around it. Perhaps that could use a little tweaking too.
  24. I definitely like the 2nd one. Reminds me of a firetruck
×
×
  • 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.