Sunday, 15 May 2011

mysql - HTTP Request 500 when I call mysqli_connect with PHP -



mysql - HTTP Request 500 when I call mysqli_connect with PHP -

i want utilize database store user data. running apache server php , mysql installed. when seek mysqli_connect, there http 500 error. code:

$con = mysqli_connect("localhost","root","password","database"); mysqli_close($con);

i checked apache log; here's said:

[time] [error] [client localhost] php fatal error: phone call undefined function mysqli_connect() in [document address] on line 78, referer: [url]

and

php warning: php startup: unable load dynamic library 'ext/php_mysqli.dll' - specified module not found.\r\n in unknown on line 0

also, var_dump(function_exists('mysqli_connect')); outputs bool(false).

i've uncommented extension=php_mysqli.dll in php.ini, checked ext directory , there php_mysqli.dll file in it, checked other stackoverflow (and other) questions this, none of answered me. reply staring @ me in face? new this.

test phpinfo () , create sure function activated

php mysql apache internal-server-error

c# - can't see some cs files while Getting Latest Version from TFS -



c# - can't see some cs files while Getting Latest Version from TFS -

i'm using tfs source control, seek latest version, .cs files missing in visual studio, when open folder project these files there can't see in solution explorer whats problem?

sounds you've run in merge issue, files can in source , retrieved without beingness refrenced in proj file.

there button on top of solution explorer, right of minimize all, looks 1 document behind another. if click show files in directory. can right-click , add together on each file want

c#

How safe is cross domain access? -



How safe is cross domain access? -

i working on personal project , have beingness considering security of sensitive data. want utilize api accessing backend , want maintain backend in different server 1 user logon to. require cross domain accessing of data.

considering lot of accessing , transaction done, have next questions help guide me in right path have tried , tested cross domain access. don't want assume , implement , run troubles , redesign when have launched service thereby losing sleep. know there no right way many things in programming there many wrong ways.

how safe in handling sensitive info (even https). does have issues handling lot of users transactions. does have downside not mentioned.

these questions asked because post have read eve discouraged utilize of cross-domain access while encouraged it. decided hear professionals have used in bigger scale.

i building mobile app, using laravel backend.

thanks..

how safe in handling sensitive info (even https).

ssl considered safe (it's used everywhere , considered standard). however, it's not less safe hitting different server. info still has traverse pipes , reach destination has same risks regardless of server.

does have issues handling lot of users transactions.

i don't see why would. server server. ultimately, server's ability handle volume transactions going based on power, efficiency of code, , application's ability scale.

does have downside not mentioned.

authentication thing comes mind. i'm confused question how log 1 access info another. seems 1 application. if want revise question, i'll update answer.

cross-domain

.net - How to implement default methods for an interface? -



.net - How to implement default methods for an interface? -

when creating new class in .net if declare "implements idisposable" , nail enter, see visual studio adds itselt differents methods , functions filled class. when seek interfaces, creates empty methods , functions.

is there way provide default implementations of methods , functions ?

i have been looking link didn't resolve issue.

example of implementation i'm looking :

#region "idisposable support" private disposedvalue boolean ' observe redundant calls ' idisposable protected overridable sub dispose(byval disposing boolean) if not me.disposedvalue if disposing ' todo: dispose managed state (managed objects). end if ' todo: free unmanaged resources (unmanaged objects) , override finalize() below. ' todo: set big fields null. end if me.disposedvalue = true end sub ' todo: override finalize() if dispose(byval disposing boolean) above has code free unmanaged resources. 'protected overrides sub finalize() ' ' not alter code. set cleanup code in dispose(byval disposing boolean) above. ' dispose(false) ' mybase.finalize() 'end sub ' code added visual basic correctly implement disposable pattern. public sub dispose() implements idisposable.dispose ' not alter code. set cleanup code in dispose(byval disposing boolean) above. dispose(true) gc.suppressfinalize(me) end sub #end part

cheers in advance.

further exaplanations of i'm looking :

let's assume next interface

here happens , i'm looking :

it knows how set basic idisposable implementation, there's mutual pattern should follow.

but how perchance know how implement interfaces? empty methods need fill in yourself.

your closest bet set snippet , insert rather letting visual studio adding unimplemented members.

.net vb.net visual-studio interface

html - PHP 'loop for' with input text form -



html - PHP 'loop for' with input text form -

i'm doing programme have insert number ("x"), , generate "x" number of "input forms" come in diferent numbers later, calculate operations.

i have generate forms using for, , then, pass results submit button $_post next page. then, when seek results for, doesn't works , problems.

notice: undefined variable: num4 in...

what doing wrong?

thank you!

<?php /*here number create "x" number of forms*/ if (isset($_post["num"])) { $num=$_post["num"]; $_post["num"]=$num; if ( is_numeric($num) , $num>=0) { echo"<form action=\"tercera.php\" method=\"post\">"; echo "quina operació vols fer?:<br><br> " . "<input type=\"radio\" name=\"operacio\" value=\"suma\"/>suma " . "<input type=\"radio\" name=\"operacio\" value=\"mitja\"/>mitja" . "<input type=\"radio\" name=\"operacio\" value=\"major\"/>major" . "<input type=\"radio\" name=\"operacio\" value=\"menor\"/>menor</p>"; /*here create loop generate forms "numero[$i]" */ ($i=1; $i<=$num; $i++) { echo" <input type=\'text\' name=\'numero[$i]\' maxlength=\'10\' size=\"10\"/>"; } echo "<p><input type='submit' value='calcula' /></p>"; } else { echo "<h3>has d'escriure united nations numero mes gran que 0, torna-ho intentar."; } }//isset*/ ?> /*/ next php page /*/ <?php if (isset($_post["operacio"])) $operacio=$_post["operacio"]; //here numbers of lastly page ($i=1; $i<=2; $i++) { if (isset($_post["numero[$i]"])) $num2=$_post["numero[$i]"] ; //here error: undefined variable: num2 echo $num2; } //this part ok ... if ($operacio == "suma") { echo "i equals 0"; } elseif ($operacio == "mitja") { echo "i equals 1"; } elseif ($operacio == "major") { echo "i equals 2"; } elseif ($operacio == "menor") { echo "i equals 3"; } if ( is_numeric($num) , $num>=0) { ($i=1; $i<=$num; $i++) { } } else { echo "<h3>has d'escriure united nations numero mes gran que 0, torna-ho intentar."; } //isset*/ ?>

in sec page don't utilize this:

if (isset($_post["numero[$i]"])) $num2=$_post["numero[$i]"];

because field doesn't exist. when utilize array of fields, need field, , after position, instance, work:

if(isset($_post["numero"]) && isset($_post["numero"][$i])) $num2=$_post["numero"][$i];

remember, using field array.

if don't want in troubles elements in array, utilize (after knowing $_post["numero] exists):

foreach($_post["numero"] $num) { echo $num; // or waht want do. }

i hope help you.

php html forms

arrays - PHP IF ELSE condition and Foreach -



arrays - PHP IF ELSE condition and Foreach -

i have little issue trying compare info 3 arrays, 1 of them source , other 2 conditions.

the scenario next:

$array1 = array('code' => '123', 'code' => '124', 'code' => '125', 'code' => '126', 'code' => '127'); $array2 = array( array('code1' => '123', 'country' => 'us', 'listed' => '0'), array('code1' => '124', 'country' => 'us', 'listed' => '1'), array('code1' => '125', 'country' => 'us', 'listed' => '1') ); $array3 = array( array('code2' => '123', 'country' => 'us', 'listed' => '1'), array('code2' => '126', 'country' => 'us', 'listed' => '0'), array('code2' => '127', 'country' => 'us', 'listed' => '1') ); $final = array_merge($array1,$array2,$array3); foreach ($final $f) { if ($f['code'] == $f['code1']) { if ($f['listed'] > 0) { $finallisted = $f['listed']; } } elseif ($f['code'] == $f['code2']) { if ($f['listed'] > 0) { $finallisted = $f['listed']; } } $newfinalarray = array( 'code' = $finalcode, 'listed' = $finallisted, 'country' = $finalcountry ); }

so need check first if code $array1 exist in $array2 , if if code $array2 listed if not check on $array3 , on.

so if code exist on $array2 , listed 1 update database values if not check $array3 if exist , listed 1 update values if not update values $array2

the thought $array2 1 site , $array3 another, so, if not in 1 sec if in both keek $array2

the problem cannot sort, have tried array_combine combines 2 arrays , parameters need exactly. array merge 3 arrays one, on foreach , on apply if conditions variable undefined.

first of see lots of issue in way arrays declared you

ex -

$array1 = array('code' = > '123', 'code' = > '124', 'code' = > '125', 'code' = > '126', 'code' = > '127');

is nil but

$array1 = array('code' => '127'); //because of same index consider lastly value

however have modified arrays , tried prepare solution might useful you. check 1 time below.

<?php $array1 = array('123', '124', '125', '126', '127'); $array2 = array(array('code' => '123', 'country' => 'us', 'listed' => '0'), array('code' => '124', 'country' => 'us', 'listed' => '1'), array('code' => '125', 'country' => 'us', 'listed' => '1')); $array3 = array(array('code' => '123', 'country' => 'us', 'listed' => '1'), array('code' => '126', 'country' => 'us', 'listed' => '0'), array('code' => '127', 'country' => 'us', 'listed' => '1')); function comparesitesandupdate($array1, $array2, $array3) { foreach($array1 $code) { if(iscodeexistsinarray($code,$array2)) { echo $code . ' in array2 , listed <br />'; } else { // ;( not in array2 check in array3 echo $code . ' not listed in array2 - checking in array3 <br />'; if(iscodeexistsinarray($code,$array3)) { echo $code . ' in array3 , listed <br />'; } else { echo $code . ' not listed in array3 - whatever want <br />'; } } } } //note $earray expected in format of $array2/$array3 //and key of $array2 , $array3 should 'code' - not necessary alter keys 2 diff arrays function iscodeexistsinarray($ecode, $earray) { foreach($earray $code_array) { if($ecode == $code_array['code']) { //code match found - check if listed if($code_array['listed'] == 1) { //got need - homecoming true , break homecoming true; } } } homecoming false; //any other case homecoming false; } comparesitesandupdate($array1, $array2, $array3); ?>

php arrays

java - Unable to connect to mysql jdbc database -



java - Unable to connect to mysql jdbc database -

i frustrated seeing error , not knowing solution. trying connect mysql db server url giving mysqlexception(stacktrace below). code works fine till here:

string dburl = "jdbc:mysql://server_url/db_name"; string driver = "com.mysql.jdbc.driver"; class.forname(driver).newinstance(); string user = "user"; string password = "password"; conn = drivermanager.getconnection(dburl,user,password);

this error i'm getting

java.sql.sqlexception: null, message server: "host '172.23.251.154' not allowed connect mysql server" @ com.mysql.jdbc.sqlerror.createsqlexception(sqlerror.java:946) @ com.mysql.jdbc.mysqlio.dohandshake(mysqlio.java:1070) @ com.mysql.jdbc.connection.createnewio(connection.java:2775) @ com.mysql.jdbc.connection.<init>(connection.java:1555) @ com.mysql.jdbc.nonregisteringdriver.connect(nonregisteringdriver.java:285) @ java.sql.drivermanager.getconnection(drivermanager.java:582) @ java.sql.drivermanager.getconnection(drivermanager.java:185)

is because i'm using different version of mysql-connector jar? please help me.

from chapter 6. sql questions: how enable tcp connections mysql?,

by default, mysql won't allow users access of databases if connect on tcp connection. in order permit connection, must create entry in user table of mysql database (make sure select password function encrypt password). in particular, host field needs indicate host(s) permitted connect. if specify % (which not recommend), user able connect host.

java mysql database jdbc