+ 3
How to show sql columns (not rows) randamly
I have a SQL record which is as I'd, que, ans1, ans2, ans3, ans4. now I want to show answers randomly how to do it using PHP? also show me that how I can echo them in HTML5
6 odpowiedzi
+ 3
$connectionInfo = array("Database"=>"dbname"[, "UID"=>"username", "PWD"=>"password"])
$serverName = "serverName\instanceName" // add ", portnumber" if you want
$conn = sqlsrv_connect( $serverName, $connectionInfo)
$randCol = array_rand(array("ID", ....), 1)
$table = "tableName"
echo(sqlsrv_query( $conn, "select ? from ?;", array($randCol, $table))
+ 3
check the connection with
if($conn){sqlsrv_query()}
else{print_r(sqlsrv_errors(), true)}
+ 3
sorry I'm not a php coder so I missed the ; everywhere
+ 1
actually I'm mechanical engineer but coding is my passion so I'm gone build website for engineering for exams and general questions that help people,
this problem I solved yesterday but now I have another problem that I mentioned in my other que. if u able to solve it, help me.
+ 1
btw thanks for trying@modak,
+ 1
How to change bg color of list if its value is xyz onclick
I have 5 variables $xyz ,$a ,$b, $c, $d. and echo $a , $b, $c, $d for Selection . now one of them is = $xyz . so how to change bgcolor of that variable on selection if selected variable is = $xyz.
also so how to implement it in HTML
below is the link of my code
https://code.sololearn.com/w9wf4viYsLhT/#php