Question : trying to write an if/else statement can someone clean this up..doesnt work...

the idea is there are two tables :
wo_table
and wo_stats
the idea is for the first sql statement to check if the 'number' (later will be a variable) is present in the table field wo_table.work_order_uids : next if its not present then the next sql statement should input
a '4' into the field wo_stats.wo_status_code...

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
<?php

include ("db.inc.php");
$sql = "SELECT wo_order_uids from wo_table where work_order_uids =417";

$result = mysql_query($sql2);
$nums = mysql_num_rows($result); 

if(!$nums > 0);
    
$sql2= "UPDATE wo_stats SET wo_status_codes = 4 WHERE work_order_uid =417";
$result2 = mysql_query($sql2);
if (!mysqli_query($link,$sql2))
{
    $error = 'Errorrr updating submitted data. ' ;
    include ("error.html.php") ;
}
    else 
    {
    echo 'table is not empty. ' ;
    }    
?>

Answer : trying to write an if/else statement can someone clean this up..doesnt work...

Actually looking at the code again, it doesn't make sense.
I have made changed and commented below.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
<?php
include ("db.inc.php");

//$query3="select work_order_uids from wo_table";


 

//$result3 = $link->query($query3); 
//if (!$result3) die(' QUERY FAILED'); 

//printf($work_order_uids);  // is $work_order_uids defined in db.inc.php? otherwise it is #undefined# here

//$work_order_uids = $link->real_escape_string($row['work_order_uids']);
$work_order_uids = 453; // or some $_POST var ??

$sql = "UPDATE wo_stats SET wo_status_codes = 4 WHERE work_order_uid =$work_order_uids ".
 "and not exists (SELECT 1 from wo_table where work_order_uids =$work_order_uids)";
if (!mysqli_query( $link, $sql) )
{
  $output = 'Error performing update: '.mysqli_error($link) ;
  include 'output.html.php' ;
  exit();
}

?>
Random Solutions  
 
programming4us programming4us