Using PHP variable inside MySQL  recordset

Can someone let me know if this is possible? I'm trying to
use a variable inside a recordset. The code below is what I have at
present but it white screens me when I try open it the page in the
browser. $qualificationchoice is the variable (line 3)
mysql_select_db($database_con_rsca, $con_rsca);
$query_rs_Instructorsearch = sprintf("SELECT * FROM
rsca_users WHERE rsca_public_region = %s AND
rsca_public_"$qualificationchoice" = %s",
GetSQLValueString($colname_rs_Instructorsearch,
"text"),GetSQLValueString($colname2_rs_Instructorsearch, "int"));
$rs_Instructorsearch =
mysql_query($query_rs_Instructorsearch, $con_rsca) or
die(mysql_error());
$row_rs_Instructorsearch =
mysql_fetch_assoc($rs_Instructorsearch);
$totalRows_rs_Instructorsearch =
mysql_num_rows($rs_Instructorsearch);

Any chance you can help me with phase 2.
I'm trying to get determine $qualificationchoice by the
setting of a form menu $_POST['qualification']
I know I'm close but it just won't quite work
Here's what I have right now:
if (isset($_POST['qualification'])) {
$colname2_rs_Instructorsearch = (get_magic_quotes_gpc()) ?
$_POST['qualification'] : addslashes($_POST['qualification']);
//code to set qualification choice
if($_POST['qualification']==1) {$qualificationchoice="CWA";}
elseif ($_POST['qualification']==2)
{$qualificationchoice="SPA";}
elseif ($_POST['qualification']==3)
{$qualificationchoice="WGL";}
elseif ($_POST['qualification']==4)
{$qualificationchoice="ML";}
elseif ($_POST['qualification']==5)
{$qualificationchoice="MLW";}
elseif ($_POST['qualification']==6)
{$qualificationchoice="MIA";}
elseif ($_POST['qualification']==7)
{$qualificationchoice="MIC";}
elseif ($_POST['qualification']==8)
{$qualificationchoice="guide";}
// code to set qualification choice ends
$colname_rs_Instructorsearch = "-1";
if (isset($_POST['region'])) {
$colname_rs_Instructorsearch = (get_magic_quotes_gpc()) ?
$_POST['region'] : addslashes($_POST['region']);
mysql_select_db($database_con_rsca, $con_rsca);
$query_rs_Instructorsearch = sprintf("SELECT * FROM
rsca_users WHERE rsca_public_region = %s AND
rsca_public_{$qualificationchoice} = 1 AND rsca_public_listme =1
AND expired =0", GetSQLValueString($colname_rs_Instructorsearch,
"text"));
$rs_Instructorsearch =
mysql_query($query_rs_Instructorsearch, $con_rsca) or
die(mysql_error());
$row_rs_Instructorsearch =
mysql_fetch_assoc($rs_Instructorsearch);
$totalRows_rs_Instructorsearch =
mysql_num_rows($rs_Instructorsearch);
?>
Any suggestion would be great
Thanks
Dave

Similar Messages

  • Using a variable inside another variable

    I'm trying to use one two variable in a package with one variable feeding its value to another variable as follows:
    Variable 1 = Count
    Variable 2 = File_Name
    Variable 1 counts up from 1;I would like to use this value as an input to Variable 2 as follows:
    SELECT LOAD_FILENAME FROM DIMSTATS_FILENAME WHERE (SELECT ROW_NUMBER() OVER (Order by FILE_ID) AS RN FROM DIMSTATS_FILENAME) = #DIMSTATS_TEST.count.
    How ever I am getting the following Error :
    +ODI-1228: Task File_Name (Variable) fails on the target  connection DDBSTAGE.
    Caused By: java.sql.SQLException: [FMWGEN][SQLServer JDBC Driver][SQLServer]The multi-part identifier "#DIMSTATS_TEST.count" could not be bound.+
    I have also noticed that the value of Variable 1 is not being passed to the Select statement above through SQLServer Profiler. If I hard-code the value of #DIMSTATS_TEST.count (Variable1) the query is successful.
    How can I get the value of Variable 1 to be passed to Variable 2?
    Could someone please help
    Thanks

    You did not mentioned how you are using those variable .
    You need to have these variable inside a package .
    It will be like
    Variable 1 (Refresh) -------OK-------->Variable 2(Refresh) ------------OK-----> Some other operation .
    Thanks,
    Sutirtha

  • How to use php variable for default tabbed panel

    I have a tabbed panel and with tabs labelled with the days of the week.  What I want to do is open up the tab that correspond to the current day.  I have been using the following to get the day in 3 char format:
    <?php
    $jd=cal_to_jd(CAL_GREGORIAN,date("m"),date("d"),date("Y"));
    echo(jddayofweek($jd,2));
    ?>
    What I want to do is replace the value for the default tab in the following statement with a variable that matches the day returned with a number:
    var TabbedPanels1 = new Spry.Widget.TabbedPanels("TabbedPanels1", {defaultTab:1});
    Please could anyone advice?
    Regards,
    Lloyd

    Hi,
    BIND_VARIABLE is useful when you have only IN variable but in your case you have IN and OUT.
    I don't know if you use the gateway for MS SQL SERVER or HSODBC/DG4ODBC but here how you can do to call a remote procedure with bind variables:
    DECLARE
    ret integer;
    inp varchar2(255);
    outp varchar2(255);
    BEGIN
    inp :='Hello World';
    outp :='';
    ret := "dbo"."in_out_proc_test"@tg4msql( inp, outp);
    dbms_output.put_line('Input value: ' ||v_ut1||' - Output value: '||v_ut2);
    END;
    The MS SQL Server procedure belongs to the user "dbo" and the database link
    being used is tg4msql.
    The following line initilaize the out variables of the procedure with an
    empty string:
    outp :=''
    I hope it helps you.
    Regards
    Mireille

  • Using JSP variable inside Java Script's alert function.

    Hi Gurus,
    We are trying to use alert function with one of the string variables populated inside JSP code, but its not working.
    Here is the code snippet, please advice.
         <%
         oracle.apps.qot.util.RequestCtx.log("qotcustom.jsp",AOLMessageManager.getMessageSt(QotUtil.QOT_APPS_CODE, "XDPYY_DISC"));
         %>
         var alert_text="<%=AOLMessageManager.getMessageSt(QotUtil.QOT_APPS_CODE, "XDPYY_DISC")%>";
         alert(alert_text);
         Here in the first line we are using API to get text message defined in database, the line is getting executed properly and we could see output text message in debug log file, after this in the 4th line, we are assiging this string output of API to java script variable alert_text and further using alert function with the variable alert_text as argument. But alert function is failing, no errors are thown in debug log file.
    Please advice whether we are doing any thing wrong.
    Thanks in advance.

    What pgeuens means is that you can't mix javascript and jsp/java code in this way.
    ALL of the jsp/java code gets executed at the server end.
    This produces an HTML page (with embedded javascript) which gets sent to the client.
    The client then runs javascript code in response to events (onLoad, onClick, onChange etc etc)
    So in this case, the jsp:forward will always be executed, because as far as the server is concerned, the javascript is just template text.
    If you WANT to do a conditional forwarding on the server side you do it in java ie (horribly using scriptlet)
    <%
    if (testCondition){
    %>
      <jsp:forward>
    %<
    %>Or if you want to test what the client has entered client side, all you can do is submit the form, or navigate to a URL
    <script>
    function test()
    if(document.f.htemp.value=="true")
    alert("jus");
    else
    var s=document.f.htemp.value;
    alert(s);
    document.f1.action="success.jsp";
    document.f.submit();
    </script>You cannot run JSP code based on your javascript code.
    Java. Javascript. Not the same thing.
    Hope this helps,
    evnafets

  • Please help on how to use variables inside a method call

    Hello guys,
    How's it goin?
    Pardon me if you find my question silly, but I am relatively
    new in ActionScript 2.0 programming.
    I have here a simple problem. It seems I can't use a variable
    inside a method call of an object. Here's the code. Please note of
    the authParams string variable below.
    import AkamaiConnection;
    import mx.services.WebService;
    var GeneratedToken:String;
    var authParams:String;
    // Create a Web Service object
    var TokGenService:WebService = new WebService("
    http://webservice.asmx?wsdl");
    // Call the web service method
    var myToken:Object = TokGenService.GenerateToken();
    // Create an AkamaiConnection object
    var connection:AkamaiConnection = new AkamaiConnection();
    connection.addEventListener("onConnect", this);
    connection.addEventListener("onError", this);
    // If you get a result from the web service, save the result
    in a variable
    myToken.onResult = function(result)
    // If you get a result from the web service, save the result
    in a variable
    myToken.onResult = function(result)
    GeneratedToken = result;
    authParams = GeneratedToken +
    "&aifp=v001&slist=37414/test/Streaming/";
    //Call the Connect method of the AkamaiConnection class
    connection.connect("cp37414.edgefcs.net/ondemand",true,true,5,true,false,"443","rtmpt",
    authParams);
    But then, if I use a hard-coded string value in lieu of the
    variable, the method call works!
    connection.connect("cp37414.edgefcs.net/ondemand",true,true,5,true,false,"443","rtmpt",
    "testStringvalue");
    I don't know what I'm missing or what I'm doing wrong... Can
    somebody help me please? I am using a 30-day trial version of Adobe
    Flash CS3. Also, when I Trace output the variables, the values are
    there. It just that they can't be read or recognize inside the
    method call. Is this a ActionScript limitation?
    Thanks so much in advance!

    The result param is a returned, “Decoded ActionScript
    object version of the XML”. I am not exactly sure what that
    means but I have had issues of returned XML values and their
    datatype. When I did have these issues I had to cast or convert
    into the desired datatype. Try one of the following, assuming the
    problem is related to the code that you have bolded.
    GeneratedToken = result.toString();
    authParams = GeneratedToken +
    "&aifp=v001&slist=37414/test/Streaming/";
    Or
    GeneratedToken = String(result);
    authParams = GeneratedToken +
    "&aifp=v001&slist=37414/test/Streaming/";
    Or
    GeneratedToken = result.toString();
    authParams = String(GeneratedToken +
    "&aifp=v001&slist=37414/test/Streaming/");

  • Problem using local variable in event loop

    I have a state machine from which I want to monitor various controls, including "Start" and "Stop" buttons.  Not every state needs to monitor the controls.  At present, most states run timed loops.  In the first state that reads the front panel, I have an Event structure (inside a While loop) that monitors the various controls' Change Value events.  For numeric controls, I update variables (in shift registers) as needed.  The "Start" button is used to end the While loop controlling the Event structure, allowing the State to exit to the next state.
    My problem comes in subsequent states that employ this same idea.  Here, I put a Local Variable bound to the Start button and use the same code, but it frequently happens that when I enter this particular state, I cannot "turn on" the control -- I push the button, but it stays off.  Curiously, if it was On when I enter, I can turn it off, but then I'm stuck not being able to turn it on.
    I mocked up a very simply routine that illustrates this.  There are two sequences (corresponding to the two states).  Both use an Event loop with a local variable bound to my Stop button (really this is an LED control with custom colors).  I've deliberately moved the "initialization" (the declaration of the control in the block diagram) out of the Event loops -- putting it inside the first loop modifies the behavior in another strange way.
    Here's my thinking on how I would expect this to work:  The code outside Event Loop 1 should have little effect.  Assume the Stop button is initially Off.  You will "sit" in Event Loop 1 until you push the Stop button, changing its value to True; this value will be passed out of the Event case and cause the first While loop to exit.  You now enter the second sequence.  As I understand the Exit tunnel, it defaults to "False", so I'd expect to stay in the second Event loop until I turn the Stop button from On to Off, which will pass out a False, and keep me in the While for one more button push.  However, this doesn't happen -- I immediately exit, as though the "True" value of the Stop local variable is being seen and recognized by the Event loop (even though it hasn't changed, at least not in the context of this second loop).
    An even more curious thing occurs if I start this routine with the Stop button turned on.  Now I start in my Event loop waiting for a change, but this time the change will be from On to Off, which won't cause an exit from the frame.  This will be reflected by having the While loop count increment.  We should now be in the state of the example above, i.e. in an Event loop waiting for the control to be pushed again, and turned On.  However, clicking the control has no effect -- I cannot get it to "turn on".
    Where am I going astray in my thinking?  What is it about this method of doing things that violates the Labview paradigm?  As far as I can tell, what I'm doing is "legal", and I don't see the flaw in my reasoning, above (of course not -- otherwise I'd have fixed it myself!).  Note that because I'm using local variables inside Event loops (and I'm doing this because there are two places in my code where I want to do such testing), the Stop control is not latching (as required).  Is there something that gets triggered/set when one reads a latched control?  Do I need to do this "manually" using my local variable?
    I'll try to attach the simple VI that illustrates this behavior.
    Bob Schor
    Attachments:
    Simple Stop Conundrum.vi ‏14 KB

    altenbach wrote:
    Ravens Fan wrote:
    NEVER have multiple event structures that share the same events. 
    Actually, that's OK.  NOT OK is having multiple event structures in the same sequence structure.
    See also: http://forums.ni.com/ni/board/message?board.id=170&message.id=278981#M278981
    That's interesting.  I had always thought I read more messages discouraging such a thing rather than saying it was okay.  Your link lead me to another thread with this message. http://forums.ni.com/ni/board/message?board.id=170&message.id=245793#M245793.  Now that thread was mainly concentrating on registered user events which would be a different, but related animal. 
    So if you have 2 event structures they each have their own event queue?  So if you have a common event, one structure pulls it off its event queue and it does not affect the other structure's event queue?  I guess the inherent problem with this particular VI was that the second event structure locked the front panel.  Since the code never got to that 2nd event structure because the  first loop never stopped because the change was from true to false.  After reading your post and the others, I did some experimentation and turned off the Lock front panel on the 2nd structure, and that prevented the lockup of the program.
    Overall, the example VI still shows problems with the architecture and I think your answer should put the original poster on the right track.  I think as a rule I would probably never put the same event in multiple structures, I feel there are better ways to communicate the same event between different parts of a program,  but I learned something by reading your reply and about how the event structures work in the background.  Thanks.

  • Reference variables inside a remote FM

    Hi,
    Can anyone explain me why I can't use reference variables inside a remote Function Module.
    How can then create a dynamic table.
    And how can I return back a dynamic table?
    Thanks.

    Thanks Thomas.
    Ok, in general we can't use a reference variable because both application or systems are on separate adress-spaces, therefore it's not possible.
    If the kernel was designed for that it could be possible, am I right?

  • Can you use a php variable to filter a recordset?

    I've got a table of 'events', which have a description and
    more importantly for this a month ID number. (1-12 for the months
    of the year, when the event takes place) .
    I've used php's date function on a page to fund out
    numerically what month it is now $thismonth = date("n");
    i want to filter my recordset by only bringing up events that
    take place during the current month so where event_month =
    $thismonth
    IS this possible? It seems like it should be easy to do but I
    can't get it to work.
    Thanks in advance
    Dave

    jnkjnkjnkjnkjn wrote:
    > i want to filter my recordset by only bringing up events
    that take place
    > during the current month so where event_month =
    $thismonth
    >
    > IS this possible? It seems like it should be easy to do
    but I can't get it to
    > work.
    Yes, it's very easy, but you need to do a little hand-coding.
    In the
    Advanced recordset dialog box set the end of the SQL query to
    WHERE
    event_month = 1. When you have saved the recordset, change
    the SQL to
    WHERE event_month = $thismonth.
    David Powers, Adobe Community Expert
    Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
    Author, "PHP Solutions" (friends of ED)
    http://foundationphp.com/

  • How do I Loop through a recordset using PHP

    I have a recordset containing a MySql table with 5 columns, each one containing an email address of an official in a club.
    Each row represents a different club, and each column a different type of official.
    The first column represents chairmen, the next treasurers etc...
    The recordset is called $mailset.
    I need to loop through each row of $mailset and extract the email addresses of each column and concatenate them into a string seperated by semi colons ; so it ends up like this:
    [email protected];[email protected];[email protected]; and so on.
    This is how the recordset is set up:
    mysql_select_db($database_dummyread, $dummyread);
    $query_mailset = "SELECT club_chair_email, club_treas_email, club_sec_email, club_delegate_email, club_deputy_email FROM clubs";
    $mailset = mysql_query($query_mailset, $dummyread) or die(mysql_error());
    $row_mailset = mysql_fetch_assoc($mailset);
    $totalRows_mailset = mysql_num_rows($mailset);
    ?>
    I tried using a  loop to step through the recordset, but it always shows the first record, so its not moving the pointer through the file.
    The pseudo code aught to be something like this:
    Initialise variables and move to the first record
    If there are records to process
                   Read a record
                        Process all columns
                Move on to the next record
    else
         if there are no records
              print an error message
    else
    Print the results.
    Can anyone give me a hint as to how to move from row to row in a recordeset under the control of a loop.
    I am using PHP and MySql. (as far as I know, it is the original - not PDO or MySqli)

    Each call to mysql_fetch_assoc($mailset) retrieves the value at the current location and increments the pointer in the recordset array. So use either a do or while loop and call mysql_fetch_assoc($mailset) from within the loop.
    From the docs:
    Returns an associative array that corresponds to the fetched row and moves the internal data pointer ahead. mysql_fetch_assoc() is equivalent to calling mysql_fetch_array() with MYSQL_ASSOC for the optional second parameter. It only returns an associative array.

  • How to use a variable made inside a movie clip from outside

    I have been searching for ages and just cant find out how to do this!
    i have set a boolean variable inside a movieclip and would like something to change outside the movieclip, using an if statement, depending on whether the variable is true or false, but cant find out how to do it anywhere!
    this may be a nob question but any help will be greatly appreciated

    Your movieclip will need to have an instance name assigned to it (via the Properties panel).  Then you should be able to use that name to target the variable...
    mcName.boolVar = etc....

  • A Fluid Gallery from MySQL using PHP and various column widths

    I have decided to try the new Fluid Layout option in Dreamweaver. I pull information from a database (MySQL) and use php to present it.
    To show a gallery, I would pull the info and use the repeater code, and something like Tom Muck's horizontal repeater script to create a gallery. The images need to be shown with other text-based information (not just a caption). However, the HR script is a set amount of columns - and I want the number of columns to change depending on the width of the browser.
    So it's more than just a gallery - pulling images from a database with Title = "x" these would be a repeated stylised DIV with multiple texts fields and styles within.
    Let's take the example of a car dealership website it must show the car image, year, prices, description etc all in different style fonts so it can just be a caption to the image.
    So the options are:
    A fixed number of columns for each width: Monitor 5, Tablet 3, Mobile 1. Can this be achieved by having a "IF" statement in the actual code, if width = x use this version of the Horizontal Repeater?
    A fluid version that has 6 columns and as you slide the browser's width you can see the gallery's width has less columns until it reaches 1 for mobile.
    The fluid version would be better.
    Any links to a tutorial or example would be most appreciated.
    Many thanks
    HVR

    The only issue with using <divs> instead of a table to create your grid columns is that you will have to set a minimum height on the <divs> to keep them all at the same depth,much like a table cell construction looks and behaves. If you don't set a minimum height the grid will look all ragged PLUS the very big drawback is the <divs> won't clear if another <div> has more content in it which is going to happen if you include a 'description' of the car as this will never be the same length unless you are prepeared to edit the text.
    See fluid sample below: You can just populate the <divs> from your database and loop through them
    <!DOCTYPE HTML>
    <html>
    <head>
    <title>Untitled Document</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <style>
    body {
        font-family: verdana;
        font-size: 13px;
    #pageWrapper {
        width: 98%;
        max-width: 980px;
        margin: 0 auto;
        overflow: hidden;
    .imageDetails {
        width: 22.5%;
        float: left;
        margin: 0 0 15px 2%;
        background-color: #CCC;
        padding: 8px 0;
        min-height: 200px;
    dl {
        margin: 0 8px;
        padding: 0;
    dt {
    float: left;
    width: 50%;
    padding: 0 0 5px 0;
    dd {
    text-align: right;
    padding: 0 0 5px 0;
    h3 {
        font-size: 13px;
        margin: 0;
        padding: 8px 8px 5px 8px;
    p {
        margin: 0;
        padding: 0 8px;
    @media screen and (max-width: 760px) {
    .imageDetails {
    width: 30%;
    float: left;
    margin: 0 0 15px 2%;
    background-color: #9F3;
    @media screen and (max-width: 480px) {
    .imageDetails {
    width: 45%;
    float: left;
    margin: 0 0 15px 2%;
    background-color: #FC9;
    @media screen and (max-width: 320px) {
    .imageDetails {
    width: 100%;
    float: none;
    margin: 0 0 15px 0;
    background-color: #9CC;
    </style>
    </head>
    <body>
    <div id="pageWrapper">
    <div class="imageDetails">
    <img src="cars/car_1jpg" alt="">
    <dl>
    <dt>Price</dt>
    <dd>&pound;8500</dd>
    <dt>Year</dt>
    <dd>2009</dd>
    </dl>
    <h3>Description</h3>
    <p>This is a description about the car</p> 
    </div>
    <!-- end imageDetails -->
    <div class="imageDetails">
    <img src="cars/car_1jpg" alt="">
    <dl>
    <dt>Price</dt>
    <dd>&pound;8500</dd>
    <dt>Year</dt>
    <dd>2009</dd>
    </dl>
    <h3>Description</h3>
    <p>This is a description about the car</p>
    </div>
    <!-- end imageDetails -->
    <div class="imageDetails">
    <img src="cars/car_1jpg" alt="">
    <dl>
    <dt>Price</dt>
    <dd>&pound;8500</dd>
    <dt>Year</dt>
    <dd>2009</dd>
    </dl>
    <h3>Description</h3>
    <p>This is a description about the car. This is a description about the car. This is a description about the car.</p> 
    </div>
    <!-- end imageDetails -->
    <div class="imageDetails">
    <img src="cars/car_1jpg" alt="">
    <dl>
    <dt>Price</dt>
    <dd>&pound;8500</dd>
    <dt>Year</dt>
    <dd>2009</dd>
    </dl>
    <h3>Description</h3>
    <p>This is a description about the car</p>
    </div>
    <!-- end imageDetails -->
    <div class="imageDetails">
    <img src="cars/car_1jpg" alt="">
    <dl>
    <dt>Price</dt>
    <dd>&pound;8500</dd>
    <dt>Year</dt>
    <dd>2009</dd>
    </dl>
    <h3>Description</h3>
    <p>This is a description about the car</p> 
    </div>
    <!-- end imageDetails -->
    </div>
    </body>
    </html>

  • Having Truble Reading and Echoing Using PHP in HTML. Possible Variable Scope Problem?

    Hey guys,
       Thanks for your always knowledgable help! Today I am working with displaying text from a text file in an HTML table using PHP. I can't get the data to display properly, I think it has something to do with the scope of the variables, but I am not sure. Here is the code I am struggeling with:
    <table width="357" border="1" cellspacing="0" cellpadding="0">
      <tr>
        <td width="165">Pizza 1</td>
        <td width="186"><? echo  $price['0']; ?></td>
      </tr>
      <tr>
        <td>Burger 1</td>
        <td><? echo $price['1']; ?></td>
      </tr>
      <tr>
        <td>Drink 1</td>
        <td><? echo $price['2']; ?></td>
      </tr>
    </table>
    In the above PHP (not shown) the array $price is filled properly (I tested by echoing each bit line by line) but by the time we get into the HTML it seems the array is empty or it is not liking how I am calling it. Does the scope of a PHP variable end with the closing "?>" tag? Am I missing something? Bellow is the full code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    <style type="text/css">
    body {
        background-color: #333;
        color: #FFF;
    </style>
    </head>
    <body>
    <?php
    $menu=fopen("prices.txt","r") or exit("Unable to open file!");
    $price=array();
    $priceposition=null;
    $tempstring;
    //This loop does all of the READING and populating of variables
    while(!feof($menu))
        //Check to see if this is the first pass, if not add one to the array possition
        if ($priceposition==null){
            $priceposition=0;
        else{
        $priceposition++;
        //populate the temparary string
        $tempstring = fgets($menu);
        //Populate the array if the temporary string is not a comment
        if(substr($tempstring,0,2) != "//"){
            $price['$priceposition']= $tempstring;
            echo $price['$priceposition'];
      //End of reading loop
    fclose($menu);
    ?>
    <table width="357" border="1" cellspacing="0" cellpadding="0">
      <tr>
        <td width="165">Pizza 1</td>
        <td width="186"><? echo  $price['0']; ?></td>
      </tr>
      <tr>
        <td>Burger 1</td>
        <td><? echo $price['1']; ?></td>
      </tr>
      <tr>
        <td>Drink 1</td>
        <td><? echo $price['2']; ?></td>
      </tr>
    </table>
    </body>
    </html>
    and you can run the code on my test server here: christianstest.info/phptest/readwritetesting/readtest.php
    thanks guys!

    MurraySummers wrote:
    Try changing this -
    fclose($menu);
    to this -
    fclose($menu);
    echo "<pre>";exit(print_r($price));
    and see what you get.
    Wow, what a great little peice of testing code, thanks! That showed me the problem right away! Is there any way to test your php line by line in Dreamweaver CS6? I am used to computer programing in Visual Studio and Eclipse where they have an option of running code line by line and seing how variables populate and change with each line of code execution. Or is thier a program that can do this for PHP?

  • Best way to update images using PHP / MySQL?

    HI
    I want to update images using PHP/MySQL, so users can update their images and maybe some other files but mainly images.
    thanks

    How messed up is this code?!
    <?php
    //connect to database
    $con = mysql_connect("testhost","testuser","pass");
    // file properies
    $file = $_FILES['image']['tmp_name'];
    if (!isset($file))
    echo "please select an image";
    else {
        $id = $_REQUEST['id_display'];
        $image = ($_FILES['image']['tmp_name']) ? file_get_contents ($_FILES['image']['tmp_name']) : '';
        $image_name = ($_FILES['image']['name']) ? addslashes($_FILES['image']['name']): '';
        $image_size = ($_FILES['image']['tmp_name']) ? getimagesize($_FILES['image']['tmp_name']): '';
        if ($image_size == FALSE)
        echo "You have not selected an image.";
        else {
            mysql_select_db("test_display", $con);
            mysql_query("UPDATE testtable SET image = '$image', imagename = '$image_name' WHERE id_display='$id'");
    ?>
    And the upload page....
    /*Update code */ /*End update code */                            

  • Can i use a environment variable inside a *.sql file?

    Hello,
    I want to create a external table.
    So i am using the command
    create or replace directory abc as 'C:\folder'.... inside a sql file.
    Now i want the path "C:\folder" to be dynamic as i am using this path in many other places also inside the sql file.So i thought to create a environment variable and put this value there.I tried using as %PATH% but it gives error..... where %PATH%=C:\folder.
    Can i use a environment variable inside a *.sql file?
    But how to do that or is there any other way.
    Thanks
    Swapna
    Edited by: user11018268 on Feb 19, 2010 1:03 AM

    user11018268 wrote:
    Actually what i want is the path "C:\folder" is not fixed it can be anything which i may not know the user may decide it later. Not supported. A directory object refers to a specific physical location (directory/folder) on a file system. Not a path.
    You can work around it by (creating and) using a function (running under a super user schema with authid definer privs). The caller (e.g. schema scott ) calls it with a physical path. E.g. GetDirectoryObject( 'C:\folder\2010\feb\week4' ).
    This function determines if there is an existing directory object for the path. If not, it uses a wildcard search to determine if there are any directory objects for parents in the path (e.g. for C:\folder\2010\feb or C:\folder\2010 or C:\folder ).
    If it finds a directory object, it interrogates the data dictionary to determine if the caller, schema scott for example, has read/write access on that directory object. If it has, it creates a new directory object and grants the caller read/write access to it. The function then returns the name of the directory object to the caller.
    The caller thus do not deal directly with directory objects. The function returns the object name given a physical path as input. Also, only a single base directory needs to be created (e.g. for C:\folder ) and access granted to the schema on it. Any sub-directory in that base directory can now be dynamically accessed by the schema.

  • CS3 mysql database connection using php

    Hi, this is my first time trying to connect to a database.  I have created a mysql database with my hosting provider.  I am also configured to use php. I have ready numerous threads on this topic, but am still confused.
    I am getting the following error message:
    When I enter the following information into the connection string, I get the following error Error http error code 404 file not found. The site does not map to ftp.readyhosting.com/_mmserverscripts/mmhttdb.php Is the location of mysql server correct? Connection name ? user defined ?aosprod?
    Mysql server = aoswebeditor.readyhostingmysql.com.  Also, this is not the same location as the web server. 
    The hosting company provides the following php code to connect to the database. 
    <?php
    $link = mysql_connect('aoswebeditor.readyhostingmysql.com', 'aosweb', '*password*');
    if (!$link) {
        die('Could not connect: ' . mysql_error());
    echo 'Connected successfully';
    mysql_select_db(aos);
    ?>
    Because of the connection dialog boxes in CS3, I have not used this php code but only used the mysql server aoswebeditor.readyhostingmysql.com.
    My requirements are very simple, I want to use the same remote database for the dreamweaver connection for the remote and testing server.
    Any ideas would be appreciated.
    Thanks. George

    First of all, you seem to be mixed up about terminology. ASP stands for Active Server Pages, and is a type of server technology similar to PHP. I think you mean ISP (Internet Service Provider). However, this is not correct, either. An ISP provides your connection to the internet. Although some ISPs also host websites for their customers, your website is normally located at a hosting company. You need to get that mixup out of the way. Otherwise, you might confuse people with future questions about ASP, when you actually mean something completely different.
    OK, lecture over...
    Your hosting company is following standard procedure by preventing remote access to MySQL databases. However, Dreamweaver does make it possible to use your remote database and website for testing purposes. It does so by uploading a hidden folder called _mmServerScripts to your remote server. This performs a local connection with your database, and then sends the results back to your local computer. When setting up your testing server definition in Dreamweaver, you need to provide the details as I indicated before. When creating a MySQL connection in Dreamweaver, fill in the server name and account details as given to you by your hosting company. If everything is set up correctly, you should be able to use your remote server and database for testing.
    Having said that, it is much better to install a local testing environment. You'll find it faster, and it also lets you make mistakes (an essential part of the learning process) in the security of a closed environment. For details of how to set up a local testing environment, see this article in the Adobe Developer Connection.

Maybe you are looking for

  • Unable to install Windows 7 Pro SP1 x64

    Hi guys, I have a Dell all in one 2310 and Dell had came out to replace the HDD as it was faulty, now when I try to install Windows 7 Pro SP1 onto the unit it comes up with "Windows cannot be installed to this disk. This computers hardware may not su

  • In a Mac, how to check in an asset from photoshop to drive?

    whenever I check in from photoshop to drive, it will show the file is locked, but "get info" shows that I am allowed to "wirte and read".

  • The problem about Java media framework

    Excuse me, How to use Real Time Protocol Vedio with web camera? My program can use MIC, but can't found camera? Please Help me

  • Weblogic 9.2 Error in poll for fd=60, revents=32

    hello, Glad to talk with you. When my web application running on weblogic 9.2,it often happens a problem, as follows: <2010-7-14 下午01时15分26秒 CST> <Error> <Kernel> <BEA-000802> <ExecuteRequest failed weblogic.utils.NestedError: Error adding FD to epol

  • Outbound queues Occupying all the dialog workprocesses

    Hi Experts, In Smq1,we have around 10laksh registered entries.as per my business requirement,we have to unregister those entries. when we try to unregister in SMQ1,which is occupying all the Dialog workprocesses in SM50.(in source system) Because of