Ask Experts Questions for FREE Help !
    hsosaj's Avatar
    hsosaj Posts: 1, Reputation: 1
    New Member

    Oct 28, 2014, 08:42 AM
    Problem with PHP script: FOR, WHILE and MYSQLI_FETCH_ARRAY
    Hi, I have an PHP script that start like this:
    for ($x = 2; $x <= count($data->sheets[0]["cells"]); $x++) {
    $familia = $data->sheets[0]["cells"][$x][1];
    $subfamilia = $data->sheets[0]["cells"][$x][2];
    $categoria = $data->sheets[0]["cells"][$x][3];
    $subcategoria = $data->sheets[0]["cells"][$x][4];
    $marca = $data->sheets[0]["cells"][$x][5];
    $serie = $data->sheets[0]["cells"][$x][6];
    $referencia = $data->sheets[0]["cells"][$x][7];

    Then I need to insert values like this:
    $re_s_mar = mysqli_query($dbc, "SELECT `id`, `marca` FROM `psm_gescom_articulos_marcas` WHERE `marca` = '$marca' LIMIT 0,1");
    while($row_s_mar = mysqli_fetch_array($re_s_mar)) {
    $id_mar = $row_s_mar['id'];
    $mar_mar = $row_s_mar['marca'];
    $res_i_mar = mysqli_query($dbc, "INSERT INTO `psm_gescom_articulos_marcas` (`marca`) VALUES ('$marca')");
    if(mysqli_affected_rows($dbc)>0){$rows = 1;}

    But donīt let me do it, Just insert the fisrt value or none.

Check out some similar questions!

Insert Image in a PHP Script. Here is my error... [ 1 Answers ]

I don't usually don't have a problem. This is my script below, following my error message. I've tried everything. What I'm I missing? <img src="images/flightattendant.jpg" alt="Jeanne - Your flight attendant" width="378" height="851" align="right" /> <?php Session_start(); // Force...

PHP Connection Problem with ODBC After Moving out from Local Machine [ 7 Answers ]

In the following, Section 1 was my original code. The php code connected with an Access file was running Apache server in my local machine, and they did work fine. However, after moving the php and Access file to a web server, and changed $db='W:\\EmpRosterDev\\UserDB.mdb'; in the php, it gets...

View more questions Search

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.