1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Solved: PHP: Does this work?

Discussion in 'Web Design & Development' started by jagonzalez, Mar 18, 2015.

Thread Status:
Not open for further replies.
Advertisement
  1. jagonzalez

    jagonzalez Thread Starter

    Joined:
    Aug 14, 2013
    Messages:
    8
    Good night,

    I have this routine that reads the table Laser with two fields and then passes that data to an array arreglolaser. Is this routine correct? How can I verify if it's working all right?



    function busca()

    {
    var n99 = document.form1.laserausar.value;

    <?php
    $i = 0;
    $sql="select * from Laser";
    $resultlaser= mysql_query($sql) or die(mysql_error());
    $row=mysql_fetch_array($resultlaser);
    while($row=mysql_fetch_row($resultlaser))
    {

    $arreglolaser [$i][0] = $row['1'];
    $arreglolaser [$i][1] = $row['2'];

    $i = $i + 1;
    }
    ?>
    }

    Thank you,
    JAG
     
  2. JiminSA

    JiminSA

    Joined:
    Dec 15, 2011
    Messages:
    3,393
    First Name:
    Jim
    No, this would not work, because ...

    There are two distinct work areas involved on websites:
    Client-side (CS) - which operates locally within your browser on the user's machine.
    Server-side (SS) - which operates remotely on the ISP's machine(s) - (Internet Service Provider).

    Generally speaking, the browser handles the interface between the two areas, but for all intents and purposes, no single language operates in both.

    CS languages - Javascript; ActionScript etc., *HTML and *CSS (* markup scripting languages not programming languages)
    Uses:-

    Make interactive webpages.
    Make stuff happen dynamically on the web page.
    Interact with temporary storage, and local storage (Cookies, localStorage).
    Send requests to the server, and retrieve data from it.
    Provide a remote service for client-side applications, such as software registration, content delivery, or remote multi-player gaming.


    SS languages - PHP, C++, C#, Java, etc.,
    Uses:-

    Process user input.
    Display pages.
    Structure web applications.
    Interact with permanent storage (SQL, files).

    This said, you would need to put your PHP code into your form1 action script. (i.e. the script designated in the action="???" part of your <form> tag.)
     
  3. colinsp

    colinsp

    Joined:
    Sep 5, 2007
    Messages:
    2,302
    First Name:
    Colin
    Also you should not be using mysql commands these are deprecated. You should be using mysqli or pdo for your mySQL queries.
     
  4. jagonzalez

    jagonzalez Thread Starter

    Joined:
    Aug 14, 2013
    Messages:
    8
    I appreciate the comments and the information, I could resolve the issue and get this working.

    Thanks!! (y):)

    JAG
     
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/1145031

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice