-
Posts
16,734 -
Joined
-
Last visited
-
Days Won
9
Everything posted by PFMaBiSmAd
-
$startpoint = date("Y, m, d", strtotime("$d_datevalue -1 month");
-
help with code - $variable_name = $connection->Execute(
PFMaBiSmAd replied to Terry Cragg's topic in PHP Coding Help
$connection in an instance of a database class. Somewhere there is a statement $connection = new class_name(); The class_name would indicate what class it is an instance of. ->Execute in a method of that database class and its name implies that it executes the database query that it is supplied as a parameter when it is called. The result that the method returns is assigned to $variable_name. -
There are a ton of 'who is online' scripts posted all over the internet. You use a database table. Anytime someone navigates to a page you insert/update a record for them in the table. If that person is logged in, as determined by your login code, you enter their username. If that person is not logged in, you enter them as a non-logged in guest. You can keep track of each guest by using the same kind of session that you are using for your logged in members, but save a value indicating the 'guest' status. To display the values you simply get a list of the logged in usernames and count the 'guest' records from the table.
-
use variable connection strings without eval?
PFMaBiSmAd replied to mottwsc's topic in PHP Coding Help
You would either use an array or a switch/case statement. You would never use eval() to determine values and variables to use. It is for when you need to evaluate php code that is in a string (such as for a template) and nothing you have shown in this post involves more than simple array indexing or simple conditional logic. -
How to append to values already in column.
PFMaBiSmAd replied to theITvideos's topic in PHP Coding Help
LOL -
How to append to values already in column.
PFMaBiSmAd replied to theITvideos's topic in PHP Coding Help
Your design needs to add a separate row for each separate piece of data - ShippingProfileID ProductID 1 1 1 4 1 6 2 3 2 7 -
A picture is worth a 1000 words. Posting your code would be the quickest way of getting an answer because it would show how you are querying the database, how you are outputting the status information, how you are managing data/variables, if you are doing something that is php/IIS/Apache specific...
-
The code that mjdamato posted has some error checking and error reporting logic in it that would tell you why the query is failing.
-
WHERE clauses are used to specify what to search for. This is the SELECT query syntax definition (commonly used parts are highlighted) -
-
PHP toggle code similar to javascript toggle div script
PFMaBiSmAd replied to djinnov8's topic in Javascript Help
Php is a server side scripting language. It does not have the ability to do anything in the browser. It simply outputs content (HTML, Javascript, css, media files) to the browser when the browser makes http request to the web server. Perhaps if you define exactly what you mean by - -
This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=310594.0
-
Your query is joining every row in descriptors with every row in plantae, then joining that with every row in relationships, and then joining that with every row in habits. Then you are only keeping the rows in all of that that match your WHERE condition. You need to specify which rows in each table are to be matched up. What columns define the relationships between each table? Edit: And since this is actually a query problem, moving thread to the mysql forum section.
-
Is the error message you posted exactly the error that is being output, with no alterations, over-typing? If so, you have two folder branches on your mac/unix machines, but only one on your Windows - projectoarc vs projectOarc because your max/unix are case sensitive operating systems and windows is not. Edit: Also, php.net has had a reoccurring problem with getting the _once versions of require/include to actually be able to tell if the same path is actually to the same file (though this should cause your Windows system to experience this problem and not the case-sensitive operating systems.)
-
mysql_real_escape_string(), as its name implies, is only useful for escaping string data (data that is in between single-quotes in your query.) For numeric data, you must either validate that it is numeric or cast it as a number.
-
Printing Simultaneously on two network printers
PFMaBiSmAd replied to watsmyname's topic in PHP Coding Help
The following example creates a .pdf document and prints it - <?php require('./fpdf.php'); // the fpdf library (w/font folder) $pdf=new FPDF(); $pdf->AddPage(); $pdf->SetFont('Arial','B',16); $pdf->Cell(40,10,'Hello World!'); $pdf->Output('c:\test.pdf'); // both of the following strings work $cmd = '"C:/Program Files/Adobe/Reader 9.0/Reader/AcroRd32.exe" /t c:/test.pdf'; // the double-quotes around the command portion are required $cmd = "\"C:/Program Files/Adobe/Reader 9.0/Reader/AcroRd32.exe\" /t c:/test.pdf"; // the double-quotes around the command portion are required shell_exec($cmd); ?> -
Printing Simultaneously on two network printers
PFMaBiSmAd replied to watsmyname's topic in PHP Coding Help
Php itself has very limited direct ability to print (Under Windows there is a 'print' extension, though it is currently not available.) You would probably need to use shell_exec() to either send commands to your operating system's 'print' command or to an application that accepts command line arguments to print a supplied document. -
A) You switched from talking about a connection to talking about the connection info. Those are not the same thing. B) You should not be making a connection per query (the function code you just posted.) A function who's purpose is to execute a query and return (or echo) the results of a specific query should not be making a database connection. For the code you posted, you would need to pass the $BDhost, $DBUser, and $DBPass connection info into the function as parameters when you call the function.
-
INSERT queries, insert a new row. It sounds like you want an UPDATE query. http://w3schools.com/php/php_mysql_update.asp
-
OMG, the goto madness has started. DON'T use goto to make simple conditional logic complicated and hard to read and follow in your code - <?php for ($count = 0; $count < 10; $count++) { $randomNumber = rand(1,50); if ($randomNumber < 10) { echo "Number less than 10: $randomNumber<br />"; } else { echo "Number greater than or equal to 10: $randomNumber<br />"; } } ?>
-
If you only use a single database connection in your script, it is already available inside functions because the mysql_ statements use the last created connection by default. However, if you need more than one connection or you are writing your code to be general purpose so that it uses a specific connection, the preferred method would be to pass the connection into the function as a parameter when the function is called.
-
No he didn't. Quotes around variables are unnecessary and actually makes the code execute a tiny bit slower.
-
No, its not. Just try it for yourself. Unless there is a main program variable by that name, using global in a function does nothing.
-
Fatal error: Call to a member function Execute() on a non-object
PFMaBiSmAd replied to Hitster4's topic in PHP Coding Help
Without even seeing all the relevant code, the obvious answer would be that it exists in one spot but not the other.