PHP - Variables In The Model (mvc)
Hello
I'm developing a Model-View-Controller framework for my personal learning curve. I've created an active record class and I've got stuck when using variables in a where clause. My problem is this: When, in a where statement, you want to find the Users with the first name Mike, you might write SELECT Firstname, Surname FROM Users WHERE Firstname = 'Mike' Where Mike is enclosed with quotation marks. When you're comparing entities quotation marks shouldn't be used. For example, SELECT Firstname, Surname, OrderTitle FROM Users, Orders WHERE Firstname = 'Mike' AND Users.Firstname = Orders.Firstname So when using variables in my where statements, like $Name = Mike $this->Where(Firstname',$Name); $this->Where('Users.Firstname','Orders.Firstname'); How do I differentiate, in my function Where() when to enclose the string with quotation marks, i.e when it is a (Table.Entity) rather than a constant. Thank you Similar TutorialsI am developing a new promising service (media-industry) in the Los Angeles area. Contact me if interested.
Leroy. liroyleshed@gmail.com Hey all,
I am making a application that requires a user to login in. I have a user model, which does such things as finds, registers, logins in, updates etc a user. It also grabs all of a users data from a database, such as their username, email address etc and checks whether or not a user is logged in.
The problem I face is this. I want to control what content a user can see depending on if they are logged in or not. In addition to this, I want to output the users data, such as their username, in other parts of the website – such as the header and footer. There is no real easy way of doing this, and requires the user model to be instantiated on every page. My question is should this class be a model or just a core library class?
Hi, I have a cakePHP program that works and displays data from a database table. The part I dont understand and I couldnt find anything on the cakephp blog as yet was the model was left blank? q1) The model is left blank but still works so what is the default behaviour here for the model? It doesnt seem to be needed to do anything i?. q2)I am selecting all the data from 1 table but how do I add a sql statement to select part of the table or a join of 2 tables? the find 'all' seems to just do that only in finding all data from a table. <?php class Post extends AppModel { /*var $name='User';*/ } ?> <?php class PostsController extends AppController { public $helpers=array('Html','Form'); public function index() { $this->set('posts',$this->Post->find('all')); } public function home() { $this->set('posts',$this->Post->find('all')); } } ?> view /// .. <?php foreach ($posts as $item): echo '<tr><td>'. $item['Post']['id']. '</td>'; echo '<td>'. $item['Post']['title'].'</td>'; echo '<td>'. $item['Post']['body'].'</td>'; echo '<td>'. $item['Post']['created'] .'</td>'; echo '</tr>'; endforeach; unset($item); ?> Can a person instantiate a model? If so how do you do it. I already know how to instantiate a class thank you This topic has been moved to Application Frameworks. http://www.phpfreaks.com/forums/index.php?topic=318251.0 Hi Everyone. I am in need of assistance, I need a form that i will use on a model agency site i am making, the form i have only has the option to upload one image and records name, age etc... What i need is a form that will upload multiple images, 2 will do but if i had a option to add more that would be great, and a pdf resume, does anyone have a similar form i can have a look at that does this, any help be awesome, i am already over the deadline. This topic has been moved to Application Frameworks. http://www.phpfreaks.com/forums/index.php?topic=355229.0 Hi all,
I was just wondering is this possible what I'm trying to do?
Models can only store one object at a time...
I'm trying to access multiple objects via one model...
<?php class users extends Model { protected $username; protected $firstname; protected $secondname; protected $age; // There will be more here... public function __construct($id = NULL) { if($id != NULL) { $this->username = $sql->getUsername($id); $this->firstname = $sql->getFirstname($id); $this->secondname = $sql->getSecondname($id); $this->age = $sql->getAge($id); } } public function numOfUsers() { $num = $sql->countAllUsers($query); return $num; } public function getUsername() { return $this->username; } public function getFirstname() { return $this->firstname; } public function getSecondname() { return $this->secondname; } public function getAge() { return $this->age; } }; class UsersView extends View { $users = new users(); for($i = 0; $i < $users->numOfUsers(); $i++) { $user = new users($i); echo "Username: {$user->getUsername()}"; echo "Username: {$user->getFirstname()}"; echo "Username: {$user->getSecondname()}"; echo "Username: {$user->getAge()}"; } }; ?> Dear Members, I am a PHP developer and desisgning a WAP page for mobiles.I need some php code to find out the model of a mobile phone from where request is coming so that based on that information I can upload the proper CSS for my page.If you can give me some hints as well that would also help me to proceed further.Currently I am able to fetch user-agent of mobile but not able to find out the specific model of mobile. does anyone know how to decode this XML variable value into string values? I also need to know the oposite way: creating variable values into xml. I've tried several code examples but they did filter the requested data. Code: [Select] $xml='<?xml version="1.0" encoding="utf-8"?> <elements> <text identifier="ed9cdd4c-ae8b-4ecb-bca7-e12a5153bc02"> <value/> </text> <textarea identifier="a77f06fc-1561-453c-a429-8dd05cdc29f5"> <value><![CDATA[<p style="text-align: justify;">Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.</p>]]></value> </textarea> <textarea identifier="1a85a7a6-2aba-4480-925b-6b97d311ee6c"> <value><![CDATA[<p style="text-align: justify;">Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.</p>]]></value> </textarea> <image identifier="ffcc1c50-8dbd-4115-b463-b43bdcd44a57"> <file><![CDATA[images/stories/red/cars/autobedrijf.png]]></file> <title/> <link/> <target/> <rel/> <lightbox_image/> <width><![CDATA[250]]></width> <height><![CDATA[187]]></height> </image> <text identifier="4339a108-f907-4661-9aab-d6f3f00e736e"> <value><![CDATA[Kramer 5]]></value> </text> <text identifier="ea0666d7-51e3-4e52-8617-25e3ad61f8b8"> <value><![CDATA[6000 RS]]></value> </text> <text identifier="90a18889-884b-4d53-a302-4e6e4595efa0"> <value><![CDATA[Eindhoven]]></value> </text> <text identifier="410d72e0-29b3-4a92-b7d7-f01e828b1586"> <value><![CDATA[APK Pick up and return]]></value> </text> <text identifier="45b86f23-e656-4a81-bb8f-84e5ea76f71f"> <value><![CDATA[15% korting op grote beurt]]></value> </text> <text identifier="3dbbe1c6-15d6-4375-9f2f-f0e7287e29f3"> <value><![CDATA[Gratis opslag zomerbanden]]></value> </text> <text identifier="2e878db0-605d-4d58-9806-8e75bced67a4"> <value><![CDATA[Gratis abonnement of grote beurt]]></value> </text> <text identifier="94e3e08f-e008-487b-9cbd-25d108a9705e"> <value/> </text> <text identifier="73e74b73-f509-4de7-91cf-e919d14bdb0b"> <value/> </text> <text identifier="b870164b-fe78-45b0-b840-8ebceb9b9cb6"> <value><![CDATA[040 123 45 67]]></value> </text> <text identifier="8a91aab2-7862-4a04-bd28-07f1ff4acce5"> <value/> </text> <email identifier="3f15b5e4-0dea-4114-a870-1106b85248de"> <value/> <text/> <subject/> <body/> </email> <link identifier="0b3d983e-b2fa-4728-afa0-a0b640fa34dc"> <value/> <text/> <target/> <custom_title/> <rel/> </link> <relateditems identifier="7056f1d2-5253-40b6-8efd-d289b10a8c69"/> <rating identifier="cf6dd846-5774-47aa-8ca7-c1623c06e130"> <votes><![CDATA[1]]></votes> <value><![CDATA[1.0000]]></value> </rating> <googlemaps identifier="160bd40a-3e0e-48de-b6cd-56cdcc9db892"> <location><![CDATA[50.895711,5.955427]]></location> </googlemaps> </elements>'; Hi. I have some code which needs to return a single variable from the function and stored as a variable within this page, so it can be echoed later on in the page. I couldn't get it to return as a variable, so i used "return compact();" to return the variable and "extract (myFunction());" to extract it to variables. However, when I turned on php's display errors and error reporting function, I got an error message saying "Warning: extract() [function.extract]: First argument should be an array in /my/web/site/index.php on line 6" (which is where my extract function is). This works fine with passing more than one variables through, is there another way pass one variable from a function to be stored as a variable on the page which called the function? Here is the function: Code: [Select] <?php //This is a list of numeric error codes against their text. this will return the error code as the variable $issue function checkLoginIssue() { //If there is an error code if (isset($_GET["issue"])) { //cycle through the list until the code is reached, return the text and break the switch switch ($_GET["issue"]) { case "1": $issue = '<p class="warning">Please log in to view this page</p>'; break; case "2": $issue = '<p class="warning">Wrong Username or Password</p>'; break; case "3": $issue = '<p class="warning">No user found with those details</p>'; break; } //return the variable in an array with a single value return compact('issue'); } } ?> And here is the code which calls the function: Code: [Select] <?php extract(checkLoginIssue()); ?> I'm running the latest stable version of PHP in Apache Server on Windows 7 64-bit.
It working fine and set up correctly.
I'd like to use ENVIRONMENT VARIABLES or a variable like "%current_directory%" or "..\%current_directory%" in the configuration files for PHP, php.ini.
Is this possible? Is php.ini a parsed file, can variables be define and used in it? Help would be much appreciated
Hello I need some help please, I've started to teach myself PHP and I'm attempting to set up some matches for a league I run. I've included the link I'm working on and just cannot seem to fix my problem. I'm trying to get it so that you can put the team members and have their names come up in the match section. Any help would be wonderful cause I have to be doing something wrong I've also now included my PHP that I have...sorry should have put it first time http://www.4funmembers.com/Pairings.php Code: [Select] <?php if ( !$_POST['submit'] ) { echo "<table border=\"0\" cellspacing=\"3\" cellpadding=\"3\">\n"; echo "<form method=\"post\" action=\"singles1.php\" target=\"_blank\">\n"; echo "<tr><td>Team 1 Name: <input type=\"text\" name=\"teamone\"/></td></tr>\n"; echo "<tr><td>Player 1: <input type=\"text\" name=\"plyr1a\"/></td></tr>\n"; echo "<tr><td>Player 2: <input type=\"text\" name=\"plyr2a\"/></td></tr>\n"; echo "<tr><td>Player 3: <input type=\"text\" name=\"plyr3a\"/></td></tr>\n"; echo "<tr><td>Player 4: <input type=\"text\" name=\"plyr4a\"/></td></tr>\n"; echo "<tr><td>Team 2 Name: <input type=\"text\" name=\"teamtwo\"/></td></tr>\n"; echo "<tr><td>Player 1: <input type=\"text\" name=\"plyr1b\"/></td></tr>\n"; echo "<tr><td>Player 2: <input type=\"text\" name=\"plyr2b\"/></td></tr>\n"; echo "<tr><td>Player 3: <input type=\"text\" name=\"plyr3b\"/></td></tr>\n"; echo "<tr><td>Player 4: <input type=\"text\" name=\"plyr4b\"/></td></tr>\n"; echo "<tr><td>Team 3 Name: <input type=\"text\" name=\"teamthree\"/></td></tr>\n"; echo "<tr><td>Player 1: <input type=\"text\" name=\"plyr1c\"/></td></tr>\n"; echo "<tr><td>Player 2: <input type=\"text\" name=\"plyr2c\"/></td></tr>\n"; echo "<tr><td>Player 3: <input type=\"text\" name=\"plyr3c\"/></td></tr>\n"; echo "<tr><td>Player 4: <input type=\"text\" name=\"plyr4c\"/></td></tr>\n"; echo "<tr><td>Team 4 Name: <input type=\"text\" name=\"teamfour\"/></td></tr>\n"; echo "<tr><td>Player 1: <input type=\"text\" name=\"plyr1d\"/></td></tr>\n"; echo "<tr><td>Player 2: <input type=\"text\" name=\"plyr2d\"/></td></tr>\n"; echo "<tr><td>Player 3: <input type=\"text\" name=\"plyr3d\"/></td></tr>\n"; echo "<tr><td>Player 4: <input type=\"text\" name=\"plyr4d\"/></td></tr>\n"; echo "<tr><td>Team 5 Name: <input type=\"text\" name=\"teamfive\"/></td></tr>\n"; echo "<tr><td>Player 1: <input type=\"text\" name=\"plyr1e\"/></td></tr>\n"; echo "<tr><td>Player 2: <input type=\"text\" name=\"plyr2e\"/></td></tr>\n"; echo "<tr><td>Player 3: <input type=\"text\" name=\"plyr3e\"/></td></tr>\n"; echo "<tr><td>Player 4: <input type=\"text\" name=\"plyr4e\"/></td></tr>\n"; echo "<tr><td>Team 6 Name: <input type=\"text\" name=\"teamsix\"/></td></tr>\n"; echo "<tr><td>Player 1: <input type=\"text\" name=\"plyr1f\"/></td></tr>\n"; echo "<tr><td>Player 2: <input type=\"text\" name=\"plyr2f\"/></td></tr>\n"; echo "<tr><td>Player 3: <input type=\"text\" name=\"plyr3f\"/></td></tr>\n"; echo "<tr><td>Player 4: <input type=\"text\" name=\"plyr4f\"/></td></tr>\n"; echo "<tr><td>Team 7 Name: <input type=\"text\" name=\"teamseven\"/></td></tr>\n"; echo "<tr><td>Player 1: <input type=\"text\" name=\"plyr1g\"/></td></tr>\n"; echo "<tr><td>Player 2: <input type=\"text\" name=\"plyr2g\"/></td></tr>\n"; echo "<tr><td>Player 3: <input type=\"text\" name=\"plyr3g\"/></td></tr>\n"; echo "<tr><td>Player 4: <input type=\"text\" name=\"plyr4g\"/></td></tr>\n"; echo "<tr><td>Team 8 Name: <input type=\"text\" name=\"teameight\"/></td></tr>\n"; echo "<tr><td>Player 1: <input type=\"text\" name=\"plyr1h\"/></td></tr>\n"; echo "<tr><td>Player 2: <input type=\"text\" name=\"plyr2h\"/></td></tr>\n"; echo "<tr><td>Player 3: <input type=\"text\" name=\"plyr3h\"/></td></tr>\n"; echo "<tr><td>Player 4: <input type=\"text\" name=\"plyr4h\"/></td></tr>\n"; echo "<tr><td>Match #1 <select name=\"teama\"><option value=\"t1\">Team 1</option>\n<option value=\"t2\">Team 2</option>\n<option value=\"t3\">Team 3</option>\n<option value=\"t4\">Team 4</option>\n<option value=\"t5\">Team 5</option>\n<option value=\"t6\">Team 6</option>\n<option value=\"t7\">Team 7</option>\n<option value=\"t8\">Team 8</option></select> vs <select name=\"teamb\"><option value=\"t1\">Team 1</option>\n<option value=\"t2\">Team 2</option>\n<option value=\"t3\">Team 3</option>\n<option value=\"t4\">Team 4</option>\n<option value=\"t5\">Team 5</option>\n<option value=\"t6\">Team 6</option>\n<option value=\"t7\">Team 7</option>\n<option value=\"t8\">Team 8</option></select></td></tr>\n"; echo "<tr><td>Match #2 <select name=\"teamc\"><option value=\"1\">Team 1</option>\n<option value=\"2\">Team 2</option>\n<option value=\"3\">Team 3</option>\n<option value=\"4\">Team 4</option>\n<option value=\"5\">Team 5</option>\n<option value=\"6\">Team 6</option>\n<option value=\"7\">Team 7</option>\n<option value=\"8\">Team 8</option></select> vs <select name=\"teamd\"><option value=\"1\">Team 1</option>\n<option value=\"2\">Team 2</option>\n<option value=\"3\">Team 3</option>\n<option value=\"4\">Team 4</option>\n<option value=\"5\">Team 5</option>\n<option value=\"6\">Team 6</option>\n<option value=\"7\">Team 7</option>\n<option value=\"8\">Team 8</option></select></td></tr>\n"; echo "<tr><td>Match #3 <select name=\"teame\"><option value=\"1\">Team 1</option>\n<option value=\"2\">Team 2</option>\n<option value=\"3\">Team 3</option>\n<option value=\"4\">Team 4</option>\n<option value=\"5\">Team 5</option>\n<option value=\"6\">Team 6</option>\n<option value=\"7\">Team 7</option>\n<option value=\"8\">Team 8</option></select> vs <select name=\"teamf\"><option value=\"1\">Team 1</option>\n<option value=\"2\">Team 2</option>\n<option value=\"3\">Team 3</option>\n<option value=\"4\">Team 4</option>\n<option value=\"5\">Team 5</option>\n<option value=\"6\">Team 6</option>\n<option value=\"7\">Team 7</option>\n<option value=\"8\">Team 8</option></select></td></tr>\n"; echo "<tr><td>Match #4 <select name=\"teamg\"><option value=\"1\">Team 1</option>\n<option value=\"2\">Team 2</option>\n<option value=\"3\">Team 3</option>\n<option value=\"4\">Team 4</option>\n<option value=\"5\">Team 5</option>\n<option value=\"6\">Team 6</option>\n<option value=\"7\">Team 7</option>\n<option value=\"8\">Team 8</option></select> vs <select name=\"teamh\"><option value=\"1\">Team 1</option>\n<option value=\"2\">Team 2</option>\n<option value=\"3\">Team 3</option>\n<option value=\"4\">Team 4</option>\n<option value=\"5\">Team 5</option>\n<option value=\"6\">Team 6</option>\n<option value=\"7\">Team 7</option>\n<option value=\"8\">Team 8</option></select></td></tr>\n"; echo "<tr><td><input type=\"submit\" name=\"submit\" value=\"Get Pairs\"/></td></tr>\n"; echo "</form></table>\n"; } else { $t1 = $_POST['plyr1a']; $t2 = $_POST['plyr1b']; $t3 = $_POST['plyr1c']; $t3 = $_POST['plyr1d']; $t4 = $_POST['plyr1e']; $t5 = $_POST['plyr1f']; $t6 = $_POST['plyr1g']; $t7 = $_POST['plyr1h']; $teama = array('1', '2', '3', '4', '5', '6', '7', '8'); $teamb = array('1', '2', '3', '4', '5', '6', '7', '8'); $teamc = array('1', '2', '3', '4', '5', '6', '7', '8'); $teamd = array('1', '2', '3', '4', '5', '6', '7', '8'); $teame = array('1', '2', '3', '4', '5', '6', '7', '8'); $teamf = array('1', '2', '3', '4', '5', '6', '7', '8'); $teamg = array('1', '2', '3', '4', '5', '6', '7', '8'); $teamh = array('1', '2', '3', '4', '5', '6', '7', '8'); if (!$plyr1a) { $errors[] = "You did not supply a team member"; } else { if (!$plyr1b) { $errors[] = "You did not supply a team member"; } else { if (!$plyr1c) { $errors[] = "You did not supply a team member"; } else { if (!$plyr1d) { $errors[] = "You did not supply a team member"; } else { if (!$plyr1e) { $errors[] = "You did not supply a team member"; if (!$plyr1f) { $errors[] = "You did not supply a team member"; } else { if (!$plyr1g) { $errors[] = "You did not supply a team member"; } else { if (!$plyr1h) { $errors[] = "You did not supply a team member"; } else { switch ($teama) { case '1': echo $_POST['plyr1a']; break; case '2': $written = $plyr1b; break; case '3': $written = $plyr1c; break; case '4': $written = $plyr1d; break; case '5': $written = $plyr1e; break; case '6': $written = $plyr1f; break; case '7': $written = $plyr1g; break; case '8': $written = $plyr1h; break; default : $written = ""; break; } echo $written; switch ($teamb) { case '1': $written = $plyr1a; break; case '2': $written = $plyr1b; break; case '3': $written = $plyr1c; break; case '4': $written = $plyr1d; break; case '5': $written = $plyr1e; break; case '6': $written = $plyr1f; break; case '7': $written = $plyr1g; break; case '8': $written = $plyr1h; break; default : $written = ""; break; } echo $written; switch ($teamc) { case '1': $written = $plyr1a; break; case '2': $written = $plyr1b; break; case '3': $written = $plyr1c; break; case '4': $written = $plyr1d; break; case '5': $written = $plyr1e; break; case '6': $written = $plyr1f; break; case '7': $written = $plyr1g; break; case '8': $written = $plyr1h; break; default : $written = ""; break; } echo $written; switch ($teamd) { case '1': $written = $plyr1a; break; case '2': $written = $plyr1b; break; case '3': $written = $plyr1c; break; case '4': $written = $plyr1d; break; case '5': $written = $plyr1e; break; case '6': $written = $plyr1f; break; case '7': $written = $plyr1g; break; case '8': $written = $plyr1h; break; default : $written = ""; break; } echo $written; switch ($teame) { case '1': $written = $plyr1a; break; case '2': $written = $plyr1b; break; case '3': $written = $plyr1c; break; case '4': $written = $plyr1d; break; case '5': $written = $plyr1e; break; case '6': $written = $plyr1f; break; case '7': $written = $plyr1g; break; case '8': $written = $plyr1h; break; default : $written = ""; break; } echo $written; switch ($teamf) { case '1': $written = $plyr1a; break; case '2': $written = $plyr1b; break; case '3': $written = $plyr1c; break; case '4': $written = $plyr1d; break; case '5': $written = $plyr1e; break; case '6': $written = $plyr1f; break; case '7': $written = $plyr1g; break; case '8': $written = $plyr1h; break; default : $written = ""; break; } echo $written; switch ($teamg) { case '1': $written = $plyr1a; break; case '2': $written = $plyr1b; break; case '3': $written = $plyr1c; break; case '4': $written = $plyr1d; break; case '5': $written = $plyr1e; break; case '6': $written = $plyr1f; break; case '7': $written = $plyr1g; break; case '8': $written = $plyr1h; break; default : $written = ""; break; } echo $written; switch ($teamh) { case '1': $written = $plyr1a; break; case '2': $written = $plyr1b; break; case '3': $written = $plyr1c; break; case '4': $written = $plyr1d; break; case '5': $written = $plyr1e; break; case '6': $written = $plyr1f; break; case '7': $written = $plyr1g; break; case '8': $written = $plyr1h; break; default : $written = ""; break; } echo $written; } } } } } } } } } ?><br> Match #1: <?php echo $_POST["teama"]; ?> vs <?php echo $_POST["teamb"]; ?> <br> Match #2: <?php echo $_POST["teamc"]; ?> vs <?php echo $_POST["teamd"]; ?> <br> Match #3: <?php echo $_POST["teame"]; ?> vs <?php echo $_POST["teamf"]; ?> <br> Match #4: <?php echo $_POST["teamg"]; ?> vs <?php echo $_POST["teamh"]; ?> <br> <br> Hello, Is it possible to use variables that are declared outside or plainly within a class, and if its possible, how? thanks in advance Hi guys I have two variables but $no1=$row[no1]; $no2=$row[no2]; I need to have another variable where i can merge these two as i need to insert them to database with sapce in between each variable like: $numbers= $no1 $no2; by doing this i get syntax error, do u know whats the best way to do this? Hello I am stuck at a point where I need to call multiple numbers for a given API
This is the code provided by the API company
// Send Message
Now My html code would be
<div class="card-header ch-alt">
<div class="card-body card-padding">
<option value='APIKEY'>APIKEY Value </option> </select><br> <br><br>
Text: * <br>
Now how do I insert multiple numbers on the Destination number...when i give commas, it gives errors but the message goes with single number
Need hlp It echos that there are to many.. how would I do this Saying like if I had 100 $Variable[] it would echo that there are to many? $Variable[] = ""; $Variable[] = ""; $Variable[] = ""; $Variable[] = ""; $Variable[] = ""; $Variable[] = ""; I'm running the latest version of MySQL on Windows 7 64-bit.
It working fine and set up correctly.
I'd like to use ENVIRONMENT VARIABLES or a variable like "%current_directory%" or "..\%current_directory%" in the configuration files for MySQL, my.ini.
Is this possible? Is my.ini a parsed file, can variables be define and used in it? Help would be much appreciated
Hi guys, I've a developer for a pretty large website and forum, the database is exploding in size and we are now seeing a grow in the slow log. We want to be able to fix this by optimizing query's but the site is so big, we can't locate the query's themselfs as they are dynamically generated. I want to be able to tail onto the end of the query a comment containing where a function was last called. In the example below, I want the file name and line-number of where add_together() was called. Here is an example for index.php: Code: [Select] $a = 1; $b = 2; $c = add_together($a, $b); function add_together($a, $b) { return $a + $b; } Look forward to your assistance with this! Joe I've got a select statement that looks like this in php. Code: [Select] $sql = "Select * from inventory where ".$fields."".$operator."".$criteria; Everything posts correctly, everything is dereferenced correctly. My only question is how do I get $criteria have single quotes around it? So that when I actually run the query it says select * from inventory where field = 'value'; I've tried Code: [Select] $sql = "Select * from inventory where ".$fields."".$operator.""'.$criteria'; $sql = "Select * from inventory where ".$fields."".$operator.""'$criteria'; and a bunch of variations like that. Thanks for you help. |